home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PROGEDIT / 2821.ZIP / UE312DOC.ZIP / EMACS.MSS < prev    next >
Text File  |  1993-04-19  |  188KB  |  4,654 lines

  1. @style(spacing 1 lines, margins .7 inches, indent 8 chars, font Times10)
  2. @Define(goodstuff, fill n, font Helvetica10)
  3. @Define(col3, columns 3, fill n)
  4. @style(indent 8 chars, spacing 1 lines, BindingMargin .5 inches)
  5. @comment(This manual is normally generated using Mark of the Unicorn's
  6. Final Word II product. Alternativily, Borland's SPRINT (derived from
  7. Final Word II) should also build it properly. Both of these formatters
  8. are based on the SCRIBE language originally used on the DECSystem-20,
  9. and will form the basis of a shareware text formatter I hope, but not
  10. promise, to complete some day.)
  11. @pagefooting()
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.         @big(@b[MicroEMACS])
  25.  
  26.         Full Screen Text Editor
  27.         Reference Manual @i(- Preliminary Version)
  28.  
  29.         Version 3.12
  30.         April 22, 1993
  31.  
  32.         (C)Copyright 1988 - 1993 by Daniel M. Lawrence
  33.         Reference Manual (C)opyright 1988 - 1993
  34.             by Brian Straight and Daniel M. Lawrence
  35.         All Rights Reserved
  36.  
  37.         @i[(C)Copyright 1988 - 1993 by Daniel M. Lawrence
  38.         MicroEMACS 3.12 can be copied and distributed freely for any
  39.         non-commercial purposes. Commercial users may use MicroEMACS
  40.         3.12 inhouse. Shareware distributors may redistribute
  41.         MicroEMACS 3.12 for media costs only. MicroEMACS 3.12 can only
  42.         be incorporated into commercial software or resold with the
  43.         permission of the current author.]
  44. @newpage
  45. @flushleft(@big[Introduction])
  46.  
  47.     MicroEMACS is a tool for creating and changing documents,
  48. programs, and other text files. It is both relatively easy for the
  49. novice to use, but also very powerful in the hands of an expert.
  50. MicroEMACS can be extensively customized for the needs of the individual
  51. user.
  52.  
  53.     MicroEMACS allows several files to be edited at the same time.
  54. The screen can be split into different windows and screens, and text may
  55. be moved freely from one window on any screen to the next. Depending on
  56. the type of file being edited, MicroEMACS can change how it behaves to
  57. make editing simple. Editing standard text files, program files and
  58. word processing documents are all possible at the same time.
  59.  
  60.     There are extensive capabilities to make word processing and
  61. editing easier. These include commands for string searching and
  62. replacing, paragraph reformatting and deleting, automatic word wrapping,
  63. word move and deletes, easy case controlling, and automatic word counts.
  64.  
  65.     For complex and repetitive editing tasks editing macroes can be
  66. written. These macroes allow the user a great degree of flexibility in
  67. determining how MicroEMACS behaves. Also, any and all the commands can
  68. be used by any keystroke by changing, or rebinding, what commands
  69. various keys invoke.
  70.  
  71.     Special features are also available to perform a diverse set of
  72. operations such as file encryption, automatic backup file generation,
  73. entabbing and detabbing lines, executing operating system commands and
  74. filtering of text through other programs (like SORT to allow sorting
  75. text).
  76.  
  77. @flushleft(@big[History])
  78.  
  79.     EMACS was originally a text editor written by Richard Stallman
  80. at MIT in the early 1970s for Digital Equipment computers. Various
  81. versions, rewrites and clones have made an appearance since.
  82.  
  83.     This version of MicroEMACS is derived from code written by Dave
  84. G. Conroy in 1985. Later modifications were performed by Steve Wilhite
  85. and George Jones. In December of 1985 Daniel Lawrence picked up the then
  86. current source (version 2.0) and made extensive modifications and
  87. additions to it over the course of the next eight years. Updates and
  88. support for the current version are still available. Commercial support
  89. and usage and resale licences are also available. The current program
  90. author can be contacted by writing to:
  91.  
  92. @begin(verbatim)
  93.     USMAIL: Daniel Lawrence
  94.         617 New York St
  95.         Lafayette, IN 47901
  96.  
  97.     UUCP:    pur-ee!mdbs!dan
  98.     ARPA:    mdbs!dan@@ee.ecn.purdue.edu
  99.  
  100.     Support is provided through:
  101.  
  102.     The Programmer's Room
  103.     Opus 201/10
  104.     300/1200/2400 and 9600 (Hayes V series only)
  105.     (317) 742-5533    no parity  8 databits  no stop bits
  106. @end(verbatim)
  107. @newpage
  108. @flushleft(@big[Credits])
  109.  
  110.     Many people have been involved in creating this software and we
  111. wish to credit some of them here. Dave Conroy, of course, wrote the very
  112. first version of MicroEMACS, and it is a credit to his clean coding that
  113. so much work was able to be done to expand it. John Gamble is
  114. responsible for writing the MAGIC mode search routines, and for
  115. maintaining all the search code. Jeff Lomicka wrote the appendix on DEC
  116. VMS and has supplied a lot of code to support VMS and the ATARI 1040ST
  117. versions. Curtis Smith wrote the original VMS code and help support the
  118. Commodore AMIGA. Also Lance Jones has done a lot of work on the AMIGA
  119. code. Professor Suresh Konda at Carnegie Mellon University has put a lot
  120. of effort into writing complex macroes and finding all the bugs in the
  121. macro language before anyone else does.
  122.  
  123.     A special thanks to Dana Hoggatt who has provided an almost
  124. daily sounding board for ideas, algorythms and code. He is responsible
  125. for the encryption code directly and has prodded me into adding many
  126. features with simple but poignant questions (Dan? How do we move the
  127. upper left corner of the screen? . . . which forced me to write the text
  128. windowing system).
  129.  
  130.     Pierre Perrot dealt with my restrictive path to a generalized
  131. windowing version, and produced an excellent version for MicroSoft
  132. Windows. He continues to assist with this environment, forcing me to
  133. keep pace with him, making all the version more interesting.
  134.  
  135.     As to people sending source code and text translations over
  136. computer networks like USENET and ARPA net, there are simply more than
  137. can be listed here. [The comments in the edit history in the history.c
  138. file mention each and the piece they contributed]. All these people
  139. should be thanked for the hard work they have put into MicroEMACS.
  140.  
  141. @closing(Daniel M. Lawrence)
  142. @newpage
  143. @string(ChapterTitle="")
  144. @set(page = 0)
  145. @pageheading(odd, left "@title[Chapter]", right "MicroEMACS Reference Manual")
  146. @pageheading(even, left "MicroEMACS Reference Manual", right "@title[Chapter]")
  147. @pagefooting(odd, left="@value(page)")
  148. @pagefooting(even, right="@value(page)")
  149. @chapter(Installation)
  150.     MicroEMACS is a programmer's text editor which is very
  151. powerfull, customizable, and exists for a large number of different
  152. types of computer systems. It is particularly usefull for people who
  153. work on a lot of different computers and want to have a familiar and
  154. powerful editor which works identically no matter what computer they are
  155. using. But before using MicroEMACS, you must INSTALL it on your computer
  156. system. Since each computer is different, there is usually a different
  157. way to install MicroEMACS for each type of computer.
  158.  
  159. @section(MSDOS - IBM-PCs)
  160. @section(UNIX)
  161. @section(ATARI ST)
  162.  
  163. @chapter(Basic Concepts)
  164.  
  165.     The current version of MicroEMACS is 3.12 (Third major re-write,
  166. twelveth public release), and for the rest of this document, we shall
  167. simply refer to this version as "EMACS". Any modifications for later
  168. versions will be in the file README on the MicroEMACS distribution disk.
  169.  
  170. @section(Keys and the Keyboard)
  171.  
  172.     Many times throughout this manual we will be talking about
  173. @index(special keys) commands and the keys on the keyboard needed to use
  174. them. There are a number of "special" keys which can be used and are
  175. listed here:
  176.  
  177. @begin(description)
  178. <NL>@\NewLine which is also called RETURN, ENTER, or <NL>, this key is
  179. used to @index(newline) end different commands. 
  180.  
  181. ^@\The control key can be used before any alphabetic character and some
  182. symbols. For example, ^C means to hold down the <CONTROL> key and type
  183. @index(control key) the C key at the same time. 
  184.  
  185. ^X@\The CONTROL-X key is used at the beginning of many different
  186. @index(control-x) commands. 
  187.  
  188. META or M-@\This is a special EMACS key used to begin many commands.
  189. @index(meta key)This key is pressed and then released before
  190. typing the next character. On most systems, this is the <ESC> key, but
  191. it can be changed. (consult appendix E to learn what key is used for
  192. META on your computer).
  193. @end(description)
  194.  
  195. Whenever a command is described, the manual will list the actual
  196. keystrokes needed to execute it in @b(boldface) using the above
  197. conventions, and also the name of the command in @i(italics).
  198. @section(Getting Started)
  199.  
  200.     In order to use EMACS, you must call it up from your system or
  201. computer's command prompt. On UNIX and MSDOS machines, just type "emacs"
  202. from the command prompt and follow it with the <RETURN> or <ENTER> key
  203. (we will refer to this key as <NL> for "new-line" for the remainder of
  204. this manual). On the Macintosh, the Amiga, the ATARI ST, and under OS/2
  205. and other icon based operating systems, double click on the uEMACS icon.
  206. Shortly after this, a screen similar to the one below should appear.
  207.  
  208. @section(Parts and Pieces)
  209.  
  210.     The screen is divided into a number of areas or @b<windows>. On
  211. some systems the top window contains a function list of unshifted and
  212. @index(windows) shifted function keys. We will discuss these keys later. 
  213. @index(mode line) Below them is an EMACS @b<mode line> which, as we will
  214. see, informs you of the present mode of operation of the editor--for
  215. example "(WRAP)" if you set EMACS to wrap at the end of each line. 
  216. @index(text window) Under the mode line is the @b<text window> where text
  217. appears and is manipulated. Since each window has its own mode line,
  218. below the text window is it's mode line. The last line of the screen is
  219. the @b(command line) where EMACS takes commands and reports on what it
  220. is doing. 
  221.  
  222. @begin(verbatim)
  223. ===============================================================================
  224. f1 search-> f2 <-search |    MicroEMACS:  Text Editor
  225. f3 hunt->   f4 <-hunt    | 
  226. f5 fkeys    f6 help    |  Available function key Pages include:
  227. f7 nxt wind f8 pg[    ] |    WORD  BOX    EMACS  PASCAL  C  cObal  Lisp
  228. f9 save     f10 exit    |  [use the f8 key to load Pages]
  229. ===============================================================================
  230.    MicroEMACS 3.12 ()       Function Keys
  231. ===============================================================================
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243. ===============================================================================
  244. ---- MicroEMACS 3.12 () -- Main -----------------------------------------------
  245. ===============================================================================
  246.         Fig 1:    EMACS screen on an IBM-PC
  247. @end(verbatim)
  248.  
  249. @section(Entering Text)
  250.  
  251. Entering text in EMACS is simple. Type the following sentence fragment:
  252.  
  253. @quotation<Fang Rock lighthouse, center of a series of mysterious and>
  254.  
  255. @flushleft(The text is displayed at the top of the text window. Now type:)
  256.  
  257. @quotation<terrifying events at the turn of the century>
  258.  
  259. Notice that some of your text has dissapeared off the left side of the
  260. screen. Don't panic--your text is safe!!! You've just discovered that
  261. EMACS doesn't "wrap" text to the next line like most word processors
  262. unless you hit <NL>. But since EMACS is used for both word processing,
  263. and text editing, it has a bit of a dual personality. You can change
  264. @index(modes) the way it works by setting various @b(modes). In this
  265. case, you need to set @b(WRAP) mode, using the @i(add-mode)
  266. @index(add-mode) command, by typing @b(^XM). The command line at the
  267. base of the screen will prompt you for the mode you wish to add. Type
  268. @b<wrap> followed by the <NL> key and any text you now enter will be
  269. wrapped. However, the command doesn't wrap text already entered. To
  270. get rid of the long line, press and hold down the <BACKSPACE> key until
  271. the line is gone. Now type in the words you deleted, watch how EMACS
  272. goes down to the next line at the right time. @i{(In some versions of
  273. EMACS, @b<WRAP> is a default mode in which case you don't have to worry
  274. about the instructions relating to adding this mode.)}
  275.  
  276. Now let's type a longer insert. Hit <NL> a couple of times to tab
  277. down from the text you just entered. Now type the following paragraphs. 
  278. Press <NL> twice to indicate a paragraph break. 
  279.  
  280. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  281. terrifying events at the turn of the century, is built on a rocky island
  282. a few miles of the Channel coast. So small is the island that wherever
  283. you stand its rocks are wet with sea spray. 
  284.  
  285. The lighthouse tower is in the center of the island. A steep flight of
  286. steps leads to the heavy door in its base. Winding stairs lead up to
  287. the crew room.>
  288.  
  289. @section<Basic cursor movement>
  290.  
  291. Now let's practice moving around in this text. To move the cursor back
  292. to the word "Winding," enter @b<M-B> @i(previous-word)
  293. @index(previous-word). This command moves the cursor backwards by one
  294. word at a time. Note you have to press the key combination every time
  295. the cursor steps back by one word. Continuously pressing META and
  296. toggling B produces an error message. To move forward to the word
  297. "stairs" enter @b<M-F> @i(next-word)@index(next-word), which moves the
  298. cursor forward by one word at a time. 
  299.  
  300. Notice that EMACS commands are usually mnemonic--F for forward, B for
  301. backward, for example.
  302.  
  303. To move the cursor up one line, enter @b<^P> @i(previous-line)
  304. @index(previous-line), down one line @b<^N> @i(next-line)
  305. @index(next-line). Practice this movement by moving the cursor to the
  306. word "terrifying" in the second line. 
  307.  
  308. The cursor may also be moved forward or backward in smaller increments. 
  309. To move forward by one character, enter @b<^F> @i(forward-character)
  310. @index(forward-character), to move backward, @b<^B>
  311. @i(backward-character) @index(backward-character). EMACS also allows
  312. you to specify a number which is normally used to tell a command to
  313. execute many times. To repeat most commands, press META and then the
  314. number before you enter the command. Thus, the command META 5 ^F
  315. (@b<M-5^F>) will move the cursor forward by five characters. Try moving
  316. around in the text by using these commands. For extra practice, see how
  317. close you can come to the word "small" in the first paragraph by giving
  318. an argument to the commands listed here. 
  319.  
  320. Two other simple cursor commands that are useful to help us move around
  321. in the text are @b<M-N> @i(next-paragraph) @index(next-paragraph) which
  322. moves the cursor to the second paragraph, and @b<M-P>
  323. @i(previous-paragraph) @index(previous-paragraph) which moves it back
  324. to the previous paragraph. The cursor may also be moved rapidly from
  325. one end of the line to the other. Move the cursor to the word "few" in
  326. the second line. Press @b<^A> @i(beginning-of-line)
  327. @index(beginning-of-line). Notice the cursor moves to the word
  328. "events" at the beginning of the line. Pressing @b<^E> @i(end-of-line)
  329. @index(end-of-line) moves the cursor to the end of the line. 
  330.  
  331. Finally, the cursor may be moved from any point in the file to the end
  332. or beginning of the file. Entering @b{M->} @i(end-of-file)
  333. @index(end-of-file) moves the cursor to the end of the buffer, @b{M-<}
  334. @i(beginning-of-file) @index(beginning-of-file) to the first character
  335. of the file. 
  336.  
  337. @i(On the IBM-PC, the ATARI ST and many other machines, the cursor keys
  338. @index(cursor keys) can also be used to move the cursor.)
  339.  
  340. Practice moving the cursor in the text until you are comfortable with
  341. the commands we've explored in this chapter.
  342.  
  343. @section(Saving your text)
  344.  
  345. When you've finished practicing cursor movement, save your file. Your
  346. @index(buffer) file currently resides in a @b<BUFFER>. The buffer is a
  347. temporary storage area for your text, and is lost when the computer is
  348. turned off. You can save the buffer to a file by entering @b<^X^S>
  349. @i(save-file) @index(save-file). Notice that EMACS informs you that
  350. your file has no name and will not let you save it.
  351.  
  352. To save your buffer to a file with a different name than it's current
  353. one (which is empty), press @b<^X^W> @i(write-file) @index(write-file). 
  354. EMACS will prompt you for the filename you wish to write. Enter the
  355. name @b<fang.txt> and press return. On a micro, the drive light will
  356. come on, and EMACS will inform you it is writing the file. When it
  357. finishes, it will inform you of the number of lines it has written to
  358. the disk. 
  359.  
  360. Congratulations!! You've just saved your first EMACS file!
  361. @newpage
  362. @heading(Chapter @value(chapter) Summary)
  363.  
  364.     In chapter @value(chapter), you learned how to enter text, how
  365. to use wrap mode, how to move the cursor, and to save a buffer. The
  366. following is a table of the commands covered in this chapter and their
  367. corresponding key bindings:
  368.  
  369. @begin{verbatim}
  370. @u(Key Binding        Keystroke    Effect)
  371.  
  372. abort-command        @b<^G>        aborts current command
  373.  
  374. add-mode        @b<^XM>     allows addition of EMACS
  375.                     mode such as @b(WRAP)
  376.  
  377. backward-character    @b<^B>        moves cursor left one character
  378.  
  379. beginning-of-file    @b{M-<}     moves cursor to beginning of file
  380.  
  381. beginning-of-line    @b<^A>        moves cursor to beginning of line
  382.  
  383. end-of-file        @b{M->}     moves cursor to end of file
  384.  
  385. end-of-line        @b<^E>        moves cursor to end of line
  386.  
  387. forward-character    @b<^F>        moves cursor right one character
  388.  
  389. next-line        @b<^N>        moves cursor to next line
  390.  
  391. next-paragraph        @b<M-N>     moves cursor to next paragraph
  392.  
  393. next-word        @b<M-F>     moves cursor forward one word
  394.  
  395. previous-line        @b<^P>        moves cursor backward by one line
  396.  
  397. previous-paragraph    @b<M-P>     moves cursor to previous paragraph
  398.  
  399. previous-word        @b<M-B>     moves cursor backward by one word
  400.  
  401. save-file        @b<^X^S>    saves current buffer to a file
  402.  
  403. write-file        @b<^X^W>    save current buffer under a new name
  404. @end(verbatim)
  405. @newpage
  406. @chapter(Basic Editing--Simple Insertions and Deletions)
  407.  
  408. @section<A Word About Windows, Buffers, Screens, and Modes>
  409.  
  410. In the first chapter, you learned how to create and save a file in
  411. EMACS. Let's do some more editing on this file. Call up emacs by
  412. typing in the following command.
  413.  
  414. @b<emacs fang.txt>
  415.  
  416. @i(On icon oriented systems, double click on the uEMACS icon, usually a
  417. file dialog box of some sort will appear. Choose @b(FANG.TXT) from the
  418. appropriate folder.)
  419.  
  420. Shortly after you invoke EMACS, the text should appear on the screen
  421. ready for you to edit. The text you are looking at currently resides in
  422. a @b<buffer>. A buffer is a temporary area of computer memory which is
  423. @index(buffer) the primary unit internal to EMACS -- this is the place
  424. where EMACS goes to work. The mode line at the bottom of the screen
  425. lists the buffer name, @b<FANG.TXT> and the name of the file with which
  426. this buffer is associated, @b<FANG.TXT>
  427.  
  428. The computer talks to you through the use of its @b(screen). This
  429. @index(screen) screen usually has an area of 24 lines each of 80
  430. characters across. You can use EMACS to subdivide the screen into
  431. several separate work areas, or @b(windows), each of which can be
  432. @index(window) 'looking into' different files or sections of text. Using
  433. windows, you can work on several related texts at one time, copying and
  434. moving blocks of text between windows with ease. To keep track of what
  435. you are editing, each window is identified by a @b(mode line) on the
  436. @index(mode line) @index(buffer) last line of the window which lists the
  437. name of the @b(buffer) which it is looking into, the file from which the
  438. text was read, and how the text is being edited. 
  439.  
  440. An EMACS @b<mode> tells EMACS how to deal with user input. As we have
  441. already seen, the mode 'WRAP' controls how EMACS deals with long lines
  442. (lines with over 79 characters) while the user is typing them in. The
  443. 'VIEW' mode, allows you to read a file without modifying it. Modes are
  444. associated with buffers and not with files; hence, a mode needs to be
  445. explicitly set or removed every time you edit a file. A new file read
  446. into a buffer with a previously specified mode will be edited under this
  447. mode. If you use specific modes frequently, EMACS allows you to set
  448. the modes which are used by all new buffers, called @b<global> modes. 
  449.  
  450. @section<Insertions>
  451.  
  452. Your previously-saved text should look like this:
  453.  
  454. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  455. terrifying events at the turn of the century, is built on a rocky island
  456. a few miles of the Channel coast. So small is the island that wherever
  457. you stand its rocks are wet with sea spray. 
  458.  
  459. The lighthouse tower is in the center of the island. A steep flight of
  460. steps leads to the heavy door in its base. Winding stairs lead up to
  461. the crew room.>
  462.  
  463. Let's assume you want to add a sentence in the second paragraph after
  464. the word "base."  Move the cursor until it is on the "W" of "Winding".
  465. Now type the following:
  466.  
  467. @quotation<This gives entry to the lower floor where the big steam
  468. generator throbs steadily away, providing power for the electric
  469. lantern.>
  470.  
  471. If the line fails to wrap and you end up with a '$' sign in the right
  472. margin, just enter @b{M-Q} @i(fill-paragraph) @index(fill-paragraph) to
  473. reformat the paragraph. This new command attempts to fill out a
  474. paragraph. Long lines are divided up, and words are shuffled around to
  475. make the paragraph look nicer. 
  476.  
  477. Notice that all visible EMACS characters are self-inserting -- all you
  478. had to do was type the characters to insert and the existing text made
  479. space for it. With a few exceptions discussed later, all non-printing
  480. characters (such as control or escape sequences) are commands. To
  481. insert spaces, simply use the space bar. Now move to the first line of
  482. the file and type @b{^O} @i(open-line) @index(open-line) (Oh, not zero). 
  483. You've just learned how to insert a blank line in your text. 
  484.  
  485. @section<Deletions>
  486.  
  487. EMACS offers a number of deletion options. For example, move the cursor
  488. until it's under the period at the end of the insertion you just did. 
  489. Press the backspace key. Notice the "n" on "lantern" disappeared. The
  490. backspace implemented on EMACS is called a @b<destructive> backspace--it
  491. removes text immediately before the current cursor position from the
  492. buffer. Now type @b<^H> @i(delete-previous-character)
  493. @index(delete-previous-character). Notice that the cursor moves back
  494. and obliterates the "r"--either command will backspace the cursor. 
  495.  
  496. Type in the two letters you erased to restore your text and move the
  497. cursor to the beginning of the buffer @b{M->} @i(beginning-of-file)
  498. @index(beginning-of-file). Move the cursor down one line to the
  499. beginning of the first paragraph. 
  500.  
  501. To delete the forward character, type @b{^D} @i(delete-next-character)
  502. @index(delete-next-character). The "F" of "Fang" disappears. Continue
  503. to type @b{^D} until the whole word is erased EMACS also permits the
  504. deletion of larger elements of text. Move the cursor to the word
  505. "center" in the first line of text. Pressing @b{M-<backspace>}
  506. @i(delete-previous-word) @index(delete-previous-word) kills the word
  507. immediately before the cursor. @b{M-^H} has the same effect. 
  508.  
  509. Notice that the commands are very similar to the control commands you
  510. used to delete individual letters. As a general rule in EMACS, control
  511. sequences affect small areas of text, META sequences larger areas. The
  512. word forward of the cursor position can therefore be deleted by typing
  513. @b{M-D} @i(delete-next-word) @index(delete-next-word). Now let's take
  514. out the remainder of the first line by typing @b{^K}
  515. @i(kill-to-end-of-line) @index(kill-to-end-of-line). You now have a
  516. blank line at the top of your screen. Typing @b{^K} again or @b{^X^O}
  517. @i(delete-blank-lines) @index(delete-blank-lines) deletes the blank line
  518. and flushes the second line to the top of the text. Now exit EMACS by
  519. typing @b{^X^C} @i(exit-emacs) @index(exit-emacs). Notice EMACS
  520. reminds you that you have not saved your buffer. Ignore the warning and
  521. exit. This way you can exit EMACS without saving any of the changes you
  522. just made. 
  523. @newpage
  524. @heading(Chapter @value(chapter) Summary)
  525.  
  526. In Chapter @value(chapter), you learned about the basic 'building
  527. blocks' of an EMACS text file--buffers, windows, and files. 
  528.  
  529. @begin{verbatim}
  530. @u(Key binding        Keystroke    Effect)
  531. delete-previous-character
  532.             @b{^H}        deletes character immediately before
  533.                     the current cursor position
  534.  
  535. delete-next-character    @b{^D}        deletes character immediately after     
  536.                     current cursor position
  537.  
  538. delete-previous-word    @b{M-^H}    deletes word immediately before
  539.                     current cursor position
  540.  
  541. delete-next-word    @b{M-D}     deletes word immediately after
  542.                     current cursor position
  543.  
  544. kill-to-end-of-line    @b<^K>        deletes from current cursor
  545.                     position to end of line
  546.  
  547. insert-space        @b<^C>        inserts a space to right of cursor
  548.  
  549. open-line        @b{^O}        inserts blank line
  550.  
  551. delete-blank-lines    @b{^X^O}    removes blank line
  552.  
  553. exit-emacs        @b{^X^C}    exits emacs
  554. @end(verbatim)
  555. @chapter(Using Regions)
  556.  
  557. @section(Defining and Deleting a Region)
  558.  
  559. At this point its time to familiarize ourselves with two more EMACS
  560. terms--the @b<point> and the @b<mark>. The point is located directly
  561. @index(point) @index(mark) behind the current cursor position. The mark
  562. (as we shall see shortly) is user defined. These two elements together
  563. are called the current @b(region) and limit the @b<region> of text on
  564. which EMACS performs many of its editing functions. 
  565.  
  566. Let's begin by entering some new text. Don't forget to add @b(wrap)
  567. mode if its not set on this buffer. Start EMACS and open a file called
  568. @b{PUBLISH.TXT}. Type in the following text:
  569.  
  570. @quotation{One of the largest growth areas in personal computing is
  571. electronic publishing. There are packages available for practically
  572. every machine from elegantly simple programs for the humble Commodore 64
  573. to sophisticated professional packages for PC and Macintosh computers. 
  574.  
  575. Electronic publishing is as revolutionary in its way as the Gutenburg
  576. press. Whereas the printing press allowed the mass production and
  577. distribution of the written word, electronic publishing puts the means
  578. of production in the hands of nearly every individual. From the class
  579. magazine to the corporate report, electronic publishing is changing the
  580. way we produce and disseminate information. 
  581.  
  582. Personal publishing greatly increases the utility of practically every
  583. computer. Thousands of people who joined the computer revolution of
  584. this decade only to hide their machines unused in closets have
  585. discovered a new use for them as dedicated publishing workstations.}
  586.  
  587. Now let's do some editing. The last paragraph seems a little out of
  588. place. To see what the document looks like without it we can cut it
  589. from the text by moving the cursor to the beginning of the paragraph. 
  590. Enter @b(M-<space>) @i(set-mark) @index(set-mark). EMACS will respond
  591. with "[Mark set]". Now move the cursor to the end of the paragraph. 
  592. You have just defined a region of text. To remove this text from the
  593. screen, type @b<^W> @i(kill-region) @index(kill-region). The paragraph
  594. disappears from the screen. 
  595.  
  596. On further consideration, however, perhaps the paragraph we cut wasn't
  597. so bad after all. The problem may have been one of placement. If we
  598. could tack it on to the end of the first paragraph it might work quite
  599. well to support and strengthen the argument. Move the cursor to the end
  600. of the first paragraph and enter @b<^Y> @i(yank) @index(yank). Your
  601. text should now look like this:
  602.  
  603. @quotation{One of the largest growth areas in personal computing is
  604. electronic publishing. There are packages available for practically
  605. every machine from elegantly simple programs for the humble Commodore 64
  606. to sophisticated professional packages for PC and Macintosh computers. 
  607. Personal publishing greatly increases the utility of practically every
  608. computer. Thousands of people who joined the computer revolution of
  609. this decade only to hide their machines unused in closets have
  610. discovered a new use for them as dedicated publishing workstations. 
  611.  
  612. Electronic publishing is as revolutionary in its way as the Gutenburg
  613. press. Whereas the printing press allowed the mass production and
  614. distribution of the written word, electronic publishing puts the means
  615. of production in the hands of nearly every individual. From the class
  616. magazine to the corporate report, electronic publishing is changing the
  617. way we produce and disseminate information.}
  618.  
  619. @section(Yanking a Region)
  620.  
  621. The text you cut initially didn't simply just disappear, it was cut into
  622. a buffer that retains the 'killed' text appropriately called the @b<kill
  623. buffer>. @b<^Y> "yanks" the text back from this buffer into the current
  624. buffer. If you have a long line (indicated, remember, by the "$"
  625. sign), simply hit @b{M-Q} to reformat the paragraph. 
  626.  
  627. There are other uses to which the kill buffer can be put. Using the
  628. @index(kill buffer) method we've already learned, define the last
  629. paragraph as a region. Now type @b<M-W> @i(copy-region)
  630. @index(copy-region). Nothing seems to have happened; the cursor stays
  631. blinking at the point. But things have changed, even though you may not
  632. be able to see any alteration. 
  633.  
  634. To see what has happened to the contents of the kill buffer, move the
  635. cursor down a couple of lines and "yank" the contents of the kill buffer
  636. back with @b<^Y>. Notice the last paragraph is now repeated. The
  637. region you defined is "tacked on" to the end of your file because
  638. @b<M-W> @b<copies> a region to the kill buffer while leaving the
  639. original text in your working buffer. Some caution is needed however,
  640. because the contents of the kill buffer are updated when you delete any
  641. regions, lines or words. If you are moving large quantities of text,
  642. complete the operation before you do any more deletions or you could
  643. find that the text you want to move has been replaced by the most recent
  644. deletion. Remember--a buffer is a temporary area of computer memory
  645. that is lost when the machine is powered down or switched off. In order
  646. to make your changes permanent, they must be saved to a file before you
  647. leave EMACS. Let's delete the section of text we just added and save
  648. the file to disk. 
  649.  
  650. @heading(Chapter @value(chapter) Summary)
  651.  
  652. In Chapter @value(chapter), you learned how to achieve longer insertions
  653. and deletions. The EMACS terms @b<point> and @b<mark> were introduced
  654. and you learned how to manipulate text with the kill buffer. 
  655.  
  656. @begin{verbatim}
  657. @begin(group)
  658. @u(Key Binding    Keystroke    Effect)
  659.  
  660. set-mark    @b{M-<space>}    Marks the beginning of a region
  661.  
  662. delete-region    @b{^W}        Deletes region between point and mark and
  663.                 places it in KILL buffer
  664.  
  665. copy-region    @b{M-W}     Copies text between point and mark into
  666.                 KILL buffer
  667.  
  668. yank-text    @b{^Y}        Inserts a copy of the KILL buffer into
  669.                 current buffer at point
  670. @end(group)
  671. @end(verbatim)
  672. @chapter(Search and Replace)
  673.  
  674. @section<Forward Search>
  675.  
  676. Load EMACS and bring in the file you just saved. Your file should look
  677. like the one below.
  678.  
  679. @quotation{One of the largest growth areas in personal computing is electronic
  680. publishing. There are packages available for practically every machine
  681. from elegantly simple programs for the humble Commodore 64 to
  682. sophisticated professional packages for PC and Macintosh computers. 
  683. Personal publishing greatly increases the utility of practically every
  684. computer. Thousands of people who joined the computer revolution of
  685. this decade only to hide their machines unused in closets have
  686. discovered a new use for them as dedicated publishing workstations. 
  687.  
  688. Electronic publishing is as revolutionary in its way as the Gutenburg
  689. press. Whereas the printing press allowed the mass production and
  690. distribution of the written word, electronic publishing puts the means
  691. of production in the hands of nearly every individual. From the class
  692. magazine to the corporate report, electronic publishing is changing the
  693. way we produce and disseminate information.}
  694.  
  695. Let's use EMACS to search for the word "revolutionary" in the second
  696. paragraph. Because EMACS searches from the current cursor position
  697. toward the end of buffers, and we intend to search forward, move the
  698. cursor to the beginning of the text. Enter @b<^S> @i(search-forward)
  699. @index(search-forward). Note that the command line now reads
  700.  
  701. "Search [] <META>:" 
  702.  
  703. EMACS is prompting you to enter the @b<search string> -- the text you
  704. want to find. Enter the word @b<revolutionary> and hit the @b<META>
  705. key. The cursor moves to the end of the word "revolutionary."
  706.  
  707. Notice that you must enter the <META> key to start the search. If you
  708. @index(<NL>) simply press <NL> the command line responds with "<NL>". 
  709. Although this may seem infuriating to users who are used to pressing the
  710. return key to execute any command, EMACS' use of <META> to begin
  711. searches allows it to pinpoint text with great accuracy. After every
  712. line wrap or carriage return, EMACS 'sees' a new line character (<NL>). 
  713. If you need to search for a word at the end of a line, you can specify
  714. this word uniquely in EMACS. 
  715.  
  716. In our sample text for example, the word "and" occurs a number of times,
  717. but only once at the end of a line. To search for this particular
  718. occurrence of the word, move the cursor to the beginning of the buffer
  719. and type @b(^S). Notice that EMACS stores the last specified
  720. @index(default string) search string as the @b<default> string. If you
  721. press @b{<META>} now, EMACS will search for the default string, in this
  722. case, "revolutionary."
  723.  
  724. To change this string so we can search for our specified "and" simply
  725. enter the word @b{and} followed by @b{<NL>}. The command
  726. line now shows:
  727.  
  728. "search [and<NL>]<META>:"
  729.  
  730. Press @b{<META>} and the cursor moves to "and" at the end of the second
  731. last line.
  732.  
  733. @section<Exact Searches>
  734.  
  735. If the mode EXACT is active in the current buffer, EMACS searches on a case
  736. sensitive basis. Thus, for example you could search for @b{Publishing}
  737. as distinct from @b{publishing}. 
  738.  
  739.  
  740. @section<Backward Search>
  741.  
  742. Backward searching is very similar to forward searching except that it
  743. is implemented in the reverse direction. To implement a reverse search,
  744. type @b{^R} @i(search-reverse) @index(search-reverse). Because EMACS
  745. makes no distinction between forward and backward stored search strings,
  746. the last search item you entered appears as the default string. Try
  747. searching back for any word that lies between the cursor and the
  748. beginning of the buffer. Notice that when the item is found, the point
  749. moves to the beginning of the found string (i.e., the cursor appears
  750. under the first letter of the search item). 
  751.  
  752. Practice searching for other words in your text.
  753.  
  754. @section<Searching and Replacing>
  755.  
  756. Searching and replacing is a powerful and quick way of making changes to
  757. your text. Our sample text is about electronic publishing, but the
  758. correct term is 'desktop' publishing. To make the necessary changes we
  759. need to replace all occurrences of the word "electronic" with "desktop."
  760. First, move the cursor to the top of the current buffer with the @b(M-<)
  761. command. Then type @b[M-R] @i(replace-string) @index(replace-string). 
  762. The command line responds:
  763.  
  764. "Replace []<META>:"
  765.  
  766. where the square brackets enclose the default string. Type the word
  767. @b<electronic> and hit @b{<META>}. The command line responds:
  768.  
  769. "with []<META>"
  770.  
  771. type @b{desktop<META>}. EMACS replaces all instances of the original
  772. word with your revision. Of course, you will have to capitalize the
  773. first letter of "desktop" where it occurs at the beginning of a
  774. sentence.
  775.  
  776. You have just completed an @b<unconditional replace>. In this
  777. operation, EMACS replaces every instance of the found string with the
  778. replacement string. 
  779.      
  780. @section<Query-Replace>
  781.  
  782. You may also replace text on a case by case basis. The @b{M-^R}
  783. @i(query-replace-string) @index(query-replace-string) command causes
  784. EMACS to pause at each instance of the found string. 
  785.  
  786. For example, assume we want to replace some instances of the word
  787. "desktop" with the word "personal." Go back to the beginning of the
  788. current buffer and enter the @b(M-^R) @i(query-replace)
  789. @index(query-replace) command. The procedure is very similar to that
  790. which you followed in the unconditional search/replace option. When the
  791. search begins however, you will notice that EMACS pauses at each
  792. instance of "publishing" and asks whether you wish to replace it with
  793. the replacement string. You have a number of options available for
  794. response:
  795.  
  796. @begin(verbatim)
  797. @u(    Response    Effect)
  798.     Y(es)    Make the current replacement and skip to the next
  799.         occurrence of the search string
  800.  
  801.     N(o)    Do not make this replacement but continue
  802.  
  803.     !    Do the rest of the replacements with no more queries
  804.  
  805.     U(ndo)    Undo just the last replacement and query for it
  806.         again (This can only go back ONE time)
  807.  
  808.     ^G    Abort the replacement command (This action does not
  809.         undo previously-authorized replacements
  810.  
  811.     . Same effect as ^G, but cursor returns to the point at
  812.         which the replacement command was given
  813.  
  814.     ?    This lists help for the query replacement command
  815. @end(verbatim)
  816.  
  817. Practice searching and searching and replacing until you feel
  818. comfortable with the commands and their effects.
  819. @begin(group)
  820. @heading(Chapter @value(chapter) Summary)
  821.  
  822. In this chapter, you learned how to search for specified strings of text
  823. in EMACS. The chapter also dealt with searching for and replacing
  824. elements within a buffer. 
  825.  
  826. @begin(verbatim)
  827. @u(Key Binding        Keystroke             Effect)
  828.  
  829. search-forward        @b{^S}    Searches from point to end of buffer.
  830.                 Point is moved from current location to
  831.                 the end of the found string
  832.  
  833. search-backward     @b{^R}    Searches from point to beginning of buffer. 
  834.                 Point is moved from current location to
  835.                 beginning of found string
  836.  
  837. replace         @b{M-R} Replace ALL occurrences of search string with 
  838.                 specified (null) string from point to the
  839.                 end of the current buffer
  840.  
  841. query-replace           @b{M-^R} As above, but pause at each found string
  842.                 and query for action
  843. @end(verbatim)
  844. @end(group)
  845. @chapter(Windows)
  846.  
  847. @section<Creating Windows>@index{Windows, Creating}
  848.  
  849. We have already met windows in an earlier chapter. In this chapter, we
  850. will explore one of EMACS' more powerful features -- text manipulation
  851. through multiple windowing. Windows offer you a powerful and easy way
  852. to edit text. By manipulating a number of windows and buffers on the
  853. screen simultaneously, you can perform complete edits and revisions on
  854. the computer screen while having your draft text or original data
  855. available for reference in another window. 
  856.  
  857. You will recall that windows are areas of buffer text that you can see
  858. @index(windows) on the screen. Because EMACS can support several screen
  859. windows simultaneously you can use them to look into different places in
  860. the same buffer. You can also use them to look at text in different
  861. buffers. In effect, you can edit several files at the same time. 
  862.  
  863. Let's invoke EMACS and pull back our file on desktop publishing by
  864. typing
  865.  
  866. @quotation<emacs publish.txt>
  867.  
  868. When the text appears, type the @b{^X2} @i(split-current-window)
  869. @index{split-current-window} command. The window splits into two
  870. windows. The window where the cursor resides is called the @b<current>
  871. window -- in this case the bottom window. Notice that each window has
  872. a text area and a mode line. The @b(command line) @index{command line}
  873. is however, common to all windows on the screen. 
  874.  
  875. The two windows on your screen are virtually mirror images of each other
  876. because the new window is opened into the same buffer as the one you are
  877. in when you issue the @i{open-window command} @index{open-window}. All
  878. commands issued to EMACS are executed on the current buffer in the
  879. current window. 
  880.  
  881. To move the cursor to the upper window (i.e., to make that window the
  882. current window, type @b{^XP} @i(previous-window) @index{previous-window}. 
  883. Notice the cursor
  884. moves to the upper or @b<previous> window. Entering @b{^XO}
  885. @i(next-window) moves to the @b{next} window. Practice moving between
  886. windows. You will notice that you can also move into the Function Key
  887. menu by entering these commands. 
  888.  
  889. Now move to the upper window. Let's open a new file. On the EMACS disk
  890. is a tutorial file. Let's call it into the upper window by typing:
  891.  
  892. @quotation<^X^F>
  893.  
  894. and press return.
  895.  
  896. Enter the filename @b<emacs.tut>.
  897.  
  898. In a short time, the tutorial file will appear in the window. We now have
  899. two windows on the screen, each looking into different buffers. We have
  900. just used the @b(^X^F) @i(find-file) @index{find-file}
  901. command to find a file and bring
  902. it into our current window.
  903.  
  904. You can scroll any window up and down with the cursor keys, or with the
  905. commands we've learned so far. However, because the area of visible
  906. text in each window is relatively small, you can scroll the current
  907. window a line at a time. 
  908.  
  909. Type @b{^X^N} @i(move-window-down)@index{move-window-down}
  910.  
  911. The current window scrolls down by one line -- the top line of text
  912. scrolls out of view, and the bottom line moves towards the top of the
  913. screen. You can imagine, if you like, the whole window slowly moving
  914. down to the end of the buffer in increments of one line. The command
  915. @b{^X^P} @i(move-window-up)@index{move-window-up} 
  916. scrolls the window in the opposite
  917. direction. 
  918.  
  919. As we have seen, EMACS editing commands are executed in the current
  920. window, but the program does support a useful feature that allows you
  921. to scroll the @b<next> window. @b<M-^Z> @i(scroll-next-up)
  922. @index{scroll-next-up} scrolls the next window up, @b{M-^V}
  923. @i(scroll-next-down)@index{scroll-next-down}  scrolls it downward. 
  924. From the tutorial window, practice scrolling the window with the
  925. desktop publishing text in it up and down. 
  926.  
  927. When you're finished, exit EMACS without saving any changes in your
  928. files. 
  929.  
  930.  
  931. Experiment with splitting the windows on your screen. Open windows
  932. into different buffers and experiment with any other files you may
  933. have. Try editing the text in each window, but don't forget to save
  934. any changes you want to keep -- you still have to save each buffer
  935. separately.
  936.  
  937. @section(Deleting Windows)@index{Windows, Deleting}
  938. Windows allow you to perform complex editing tasks with ease. However,
  939. they become an inconvenience when your screen is cluttered with open
  940. windows you have finished using. The simplest solution is to delete
  941. unneeded windows. The command @b{^X0} @i{delete-window}
  942. will delete the window you are currently working in and move you to the
  943. next window.
  944.  
  945. If you have a number of windows open, you can delete all but the current
  946. window by entering @b{^X1} @i{delete-other-windows}.
  947.  
  948. @section(Resizing Windows)@index{Windows, Resizing} 
  949.  
  950. During complex editing tasks, you will probably find it convenient to
  951. have a number of windows on the screen simultaneously. However this
  952. situation may present inconveniences because the more windows you have
  953. on the screen the smaller they are; in some cases, a window may show
  954. only a couple of lines of text. To increase the flexibility and utility
  955. of the window environment, EMACS allows you to resize the window you are
  956. working in (called, as you will recall, the @b<current> window) to a
  957. convenient size for easier editing, and then shrink it when you no
  958. longer need it to be so large. 
  959.  
  960. Let's try an example. Load in any EMACS text file and split the current
  961. window into two. Now type @b{^X^(Shift-6)},
  962. @i{grow-window}@index{grow-window}. Your current window should be
  963. the lower one on the screen. Notice that it increases in size upwards
  964. by one line. If you are in the upper window, it increases in size in a
  965. downward direction. The command @b{^X^Z},
  966. @i{shrink-window}@index{shrink-window} correspondingly decreases window
  967. size by one line at a time. 
  968.  
  969. EMACS also allows you to resize a window more precisely by entering a
  970. numeric argument specifying the size of the window in lines. To resize
  971. the window this way, press the META key and enter a numeric argument
  972. (remember to keep it smaller than the number of lines on your screen
  973. display) then press @b{^XW} @i{resize-window}@index{resize-window}. 
  974. The current window will be enlarged or shrunk to the number of lines
  975. specified in the numeric argument. For example entering:
  976.  
  977. @quotation{@b[M-8 ^XW]}will resize the current window to 8 lines.
  978.  
  979. @section(Repositioning within a Window)
  980.  
  981. The cursor may be centered within a window by entering @b{M-! or M-^L}
  982. @i{redraw-display} @index{redraw-display}. This command is especially
  983. useful in allowing you to quickly locate the cursor if you are moving
  984. frequently from window to window. You can also use this command to move
  985. the line containing the cursor to any position within the current
  986. window. This is done by using a numeric argument before the command.
  987. Type @b(M-<n> M-^L) where <n> is the number of the line within the
  988. window that you wish the current line to be displayed.
  989.  
  990. The @b{^L} @i{clear-and-redraw} @index{clear-and-redraw} command is
  991. useful for 'cleaning up' a 'messy' screen that can result of using EMACS
  992. on a mainframe system and being interrupted by a system message. 
  993. @newpage
  994. @u<Chapter @value(chapter) summary>
  995.  
  996. In Chapter @value(chapter) you learned how to manipulate windows and the
  997. editing flexibility they offer. 
  998.  
  999. @begin(verbatim)
  1000. @u(Key Binding    Keystroke    Effect)
  1001.  
  1002. open-window    @b{^X2}        Splits current window into two windows if
  1003.                 space available
  1004.  
  1005. close-windows    @b{^X1}     Closes all windows except current window
  1006.  
  1007. next-window    @b{^XO}[oh]    Moves point into next (i.e. downward) window
  1008.  
  1009. previous-window @b{^XP}     Moves point to previous (i.e. upward) window
  1010.  
  1011. move-window-down @b{^X^N}    Scrolls current window down one line
  1012.  
  1013. move-window-up    @b{^X^P}    Scrolls current window up one line
  1014.  
  1015. redraw-display    @b{M !} or    Window is moved so line with point
  1016.         @b{M ^L}    (with cursor) is at center of window
  1017.  
  1018. grow-window    @b{M-X ^}    Current window is enlarged by one
  1019.                 line and nearest window is shrunk by 
  1020.                 one line
  1021.  
  1022. shrink-window    @b{^X^Z}    Current window is shrunk by one line
  1023.                 and nearest window is enlarged by one line
  1024.  
  1025. clear-and-redraw @b{^L}     Screen is blanked and redrawn. Keeps
  1026.                 screen updates in sync with your commands
  1027.  
  1028. scroll-next-up    @b{M-^Z}    Scrolls next window up by one line
  1029.  
  1030. scroll-next-down @b{M-^V}    Scrolls next window down by one line
  1031.  
  1032. delete-window    @b{^X0}     Deletes current window
  1033.  
  1034. delete-other-windows @b{^X1}    Deletes all but current window
  1035.  
  1036. resize-window    @b{^X^W}    Resizes window to a given numeric argument
  1037. @end(verbatim)
  1038. @chapter(Using a Mouse)
  1039.  
  1040.     On computers equipped with a mouse@index(mouse), the mouse can
  1041. usually be used to make editing easier. If your computer has a mouse,
  1042. let's try using it. Start MicroEMACS by typing:
  1043.  
  1044.     emacs publish.txt
  1045.  
  1046.     This brings EMACS up and allows it to edit the file from the
  1047. last chapter. If the function key window is visible on the screen,
  1048. press the F5 key to cause it to disappear. Now use the @b(^X2)
  1049. @i(split-current-window) command to split the screen into two windows. 
  1050. Next use the @b(^X^F) @i(find-file) command to read in the @b(fang.txt)
  1051. file. Now your screen should have two windows looking into two
  1052. different files.
  1053.  
  1054.     Grab the mouse and move it around. On the screen an arrow, or
  1055. block of color appears. This is called the mouse cursor @index(mouse
  1056. cursor) and can be positioned on any character on the screen. On some
  1057. computers, positioning the mouse cursor in the extreme upper right or
  1058. left corner may bring down menus which allow you to access that
  1059. computers utilities, sometimes called @b(Desk Accessories) @index(desk
  1060. accessories).
  1061.  
  1062. @section(Moving around with the mouse)
  1063.  
  1064.     Using the mouse button (or the left button if the mouse has more
  1065. than one), position the mouse over some character in the current window. 
  1066. Click the mouse button once. The @b(point) will move to where the mouse
  1067. cursor is. If you place the mouse cursor past the end of a line, the
  1068. point will move to the end of that line.
  1069.  
  1070.     Move the mouse cursor into the other window and click on one of
  1071. the characters there. MicroEMACS will automatically make this window
  1072. the current window (notice that the mode line changes) and position the
  1073. point to the mouse cursor. This makes it very easy to use the mouse to
  1074. switch to a different window quickly.
  1075.  
  1076. @section(Dragging around)
  1077.  
  1078.     Besides just using the mouse to move around on the screen, you
  1079. can use the same button to move text. Move the mouse cursor to a
  1080. character in one of the windows, and click down... but don't let the
  1081. button up yet!    The point will move to where the mouse cursor is. Now
  1082. move the mouse cursor up or down on the screen, and release the button.
  1083. The point will again move to where the mouse cursor is, but this time
  1084. it will bring the text under it along for the ride. This is called
  1085. @b(dragging)@index(dragging), and is how you can make the text appear
  1086. just where you want it to. If you try to drag text out of the current
  1087. window, EMACS will ignore your attempt and leave the point where you
  1088. first clicked down. @index(vertical scrolling)
  1089.  
  1090.     Now, click down on a word in one of the windows, and drag it
  1091. directly to the left. Release the button and watch as the entire
  1092. window slides, or @b(scrolls) @index(horizontal scrolling) to the left. 
  1093. The missing text has not been deleted, it is simply not visible, off the
  1094. left hand side of the screen. Notice the mode line has changed and now
  1095. looks like:
  1096.  
  1097. @flushleft(==== MicroEMACS 3.12 [<12] () == fang.txt == File: fang.txt ==============)
  1098.  
  1099.     The number insided the brackets [] shows that the screen is now
  1100. scrolled 12 characters from the left margin.
  1101.  
  1102.     Now grab the same text again, and drag it to the right, pulling
  1103. the rest of the text back into the current window. The [<] field will
  1104. disappear, meaning that the window is no longer scrolled to the left. 
  1105. This feature is very useful for looking at wide charts and tables. 
  1106. Remember, MicroEMACS will only scroll the text in the current window
  1107. sideways if you drag it straight to the side, otherwise it will drag
  1108. the text vertically.
  1109.  
  1110.     Now, place the mouse cursor over a character on the upper mode
  1111. line, click down, move the mouse cursor up or down a few lines and let
  1112. go of the button. The mode line moves to where you dragged it, 
  1113. changing the size of the windows above and below it. If you try to
  1114. make a window with less than one line, EMACS will not let you. Dragging
  1115. the mode lines can make it very fast and easy for you to rearrange the
  1116. windows as you would like.
  1117.  
  1118.     If you have a number of different windows visible on the screen,
  1119. positioning the mouse over the mode line of one window and clicking the
  1120. right mouse button will cause that window to be deleted.
  1121.  
  1122. @section(Cut and Paste)
  1123.  
  1124.     If your mouse has two buttons, then you can use the right
  1125. button to do some other things as well. Earlier, we learned how to
  1126. define a @b(region)@index(region) by using the @b(M-<space>)
  1127. @i(set-mark) command. Now, position the mouse over at the beginning of
  1128. a region you would like to copy. Next click and hold down the right
  1129. mouse button. Notice that the point jumps to the mouse cursor and
  1130. EMACS reports "[Mark Set]". Holding the button down move the mouse to
  1131. the end of the text you wish to copy and release the mouse button. 
  1132. Emacs reports "[Region Copied]" to let you know it has copied the
  1133. region into the KILL buffer. This has done the same job as the @b(M-W)
  1134. @i(copy-region) command.
  1135.  
  1136.     If you now click the right mouse button,
  1137. without moving the mouse, the region you defined dissapear, being
  1138. @b(cut)@index(cut) from the current buffer. This works just like the
  1139. @b(^W) @i(kill-region) command.
  1140.  
  1141.     If you move the mouse away from where you cut the text, and
  1142. click the right mouse button down and up without moving the mouse, the
  1143. text in the KILL buffer gets inserted, or pasted@index(paste) into the
  1144. current buffer at the point.
  1145.  
  1146. @section(Screens)
  1147.  
  1148.     MicroEMACS can use more than one screen@index(screen) at once.
  1149. Each screen is a collection of @i(windows) along with a mode line. These
  1150. screens usually fill the terminal or computer screen on text based
  1151. systems, but can also be held in different @b(windows) on graphically
  1152. based systems like MicroSoft Windows, OS/2, the Macintosh Finder and
  1153. X-Windows. Don't be confused by the two different uses of the term
  1154. "window". Inside EMACS style editors, a @i(window) lets you view part of
  1155. a buffer. Under graphical operating systems, a @b(window) holds a
  1156. "virtual terminal", allowing you to manipulate more than one job,
  1157. editing session or program at once. Within MicroEMACS, these operating
  1158. system @b(window)s are called screens. All these screens are displayed
  1159. on your current desktop@index(desktop).
  1160.  
  1161. @section(Resizing a Screen)
  1162.  
  1163.     You can change the size of a screen. Move the mouse to the last
  1164. position of the command line. Press the left mouse button down. Holding
  1165. it, move the mouse to the place you want the new lower right corner.
  1166. Release the mouse. The desktop redraws, with your newly resized screen.
  1167. MicroEMACS will ignore size changes that can not be done, like
  1168. attempting to pull the lower left corner above the upper right corner of
  1169. the current screen.
  1170.  
  1171. @section(Moving a Screen)
  1172.  
  1173.     To change where on the desktop a screen is placed, move the
  1174. mouse to the upper right corner of the screen, press the left mouse
  1175. button down, move the mouse and release it where you want the screen
  1176. displayed. Again, MicroEMACS will ignore placements that can not be
  1177. done.
  1178.  
  1179. @section(Creating a Screen)
  1180.  
  1181.     Creating a new screen is just like moving a screen, but using
  1182. the right button. Move to the upper right of an existing screen, press
  1183. the right mouse button down, and move the mouse, releasing the button
  1184. where the new screen should appear. A new screen will have a single
  1185. @b(window), containing the contents of the current window in the copied
  1186. screen, and will have that @b(window)'s colors. The new screen will have
  1187. the copied screen's size.
  1188.  
  1189. @section(Switching to a Screen)
  1190.  
  1191.     This is simple. Any mouse command can be done in any screen by
  1192. placing the mouse on a visible part of the screen and clicking. The last
  1193. screen the mouse is used on comes to front and is the current screen.
  1194. Also, the @b(A-C) @i(cycle-screens)@index(cycle-screens) command brings
  1195. the rearmost screen to front.
  1196.  
  1197. @section(Deleting a Screen)
  1198.  
  1199.     Place the mouse on the command line of the screen you want to
  1200. delete. Click the right mouse button, the screen will disapear. If you
  1201. delete the only remaining screen on the desktop, MicroEMACS will exit.
  1202. @newpage
  1203. @heading(Chapter @value(chapter) Summary)
  1204.  
  1205. In Chapter @value(chapter), you learned how to use the mouse to move the
  1206. point, switch windows, drag text, and resize windows. You also learned
  1207. how to use the right mouse button in order to copy and delete regions
  1208. and yank them back at other places. And lastly, you learned how to
  1209. control multiple screens with the mouse.
  1210.  
  1211. @begin{verbatim}
  1212. @begin(group)
  1213. @u(Action    Mouse Directions)
  1214.  
  1215. Move Cursor    position mouse cursor over desired location
  1216.         click down and up with left button
  1217.  
  1218. Drag Text    position mouse cursor over desired text
  1219.         click left button down
  1220.         move to new screen location for text
  1221.         release mouse button
  1222.  
  1223. Resize Windows    position mouse cursor over mode line to move
  1224.         click left button down
  1225.         move to new location for mode line
  1226.         release mouse button
  1227.  
  1228. Delete Window    position mouse cursor over mode line of window to delete
  1229.         click right mouse button
  1230.  
  1231. Activate Screen    Move mouse over existing screen
  1232.         click left button down and up
  1233.  
  1234. Resize Screen    position mouse cursor over last character on message line
  1235.         click left button down
  1236.         move to new lower right corner of screen
  1237.         release mouse button
  1238.  
  1239. Copy Region    position mouse at beginning of region
  1240.         click right button down
  1241.         move to end of region
  1242.         release mouse button
  1243.  
  1244. Cut Region    position mouse at beginning of region
  1245.         click right button down
  1246.         move to end of region
  1247.         release mouse button
  1248.         click right button down and up
  1249.  
  1250. Paste Region    position mouse at place to paste
  1251.         click right button down and up
  1252.  
  1253. Create Screen    position mouse at upper left corner of existing screen
  1254.         click right button down
  1255.         move to position of new screen
  1256.         release mouse button
  1257.  
  1258. Resize Screen    position mouse at lower right corner of screen
  1259.         click left button down
  1260.         move to new lower left corner
  1261.         release mouse button
  1262.  
  1263. Move Screen    position mouse at upper right corner of screen
  1264.         click left button down
  1265.         move to new screen position
  1266.         release mouse button
  1267.  
  1268. Delete Screen    position to command line of existing screen
  1269.         click right button down
  1270.         release mouse button
  1271. @end(group)
  1272. @end(verbatim)
  1273. @chapter(Buffers)
  1274.  
  1275. @index(buffer)We have already learned a number of things about buffers.
  1276. As you will recall, they are the major internal entities in EMACS --
  1277. the place where editing commands are executed. They are characterized
  1278. by their @b<names>, their @b<modes>, and by the file with which they
  1279. are associated. Each buffer also "remembers" its @b(mark) and
  1280. @b(point). This convenient feature allows you to go to other buffers
  1281. and return to the original location in the "current" buffer. 
  1282.  
  1283. Advanced users of EMACS frequently have a number of buffers in the
  1284. computer's memory simultaneously. In the last chapter, for example, you
  1285. opened at least two buffers -- one into the text you were editing, and
  1286. the other into the EMACS on-line tutorial. If you deal with complex
  1287. text files -- say, sectioned chapters of a book, you may have five or
  1288. six buffers in the computer's memory. You could select different
  1289. buffers by simply calling up the file with @b{^X^F} @i(find-file)
  1290. @index(find-file), and let EMACS open or reopen the buffer. However,
  1291. EMACS offers fast and sophisticated buffering techniques that you will
  1292. find easy to master and much more convenient to use. 
  1293.  
  1294. Let's begin by opening three buffers. You can open any three you
  1295. choose, for example call the following files into memory: @b(fang.txt),
  1296. @b(publish.txt), and @b(emacs.tut) in the order listed here. When
  1297. you've finished this process, you'll be looking at a screen showing the
  1298. EMACS tutorial. Let's assume that you want to move to the fang.txt
  1299. buffer. Enter:
  1300.  
  1301. @b{^XX} @i(next-buffer) @index(next-buffer)
  1302.  
  1303. This command moves you to the @u<next> buffer. Because EMACS cycles
  1304. through the buffer list, which is alphabetized, you will now be in the
  1305. @b(fang.txt) buffer. Using @b(^XX) again places you in the
  1306. @b(publish.txt) buffer. @i(If you are on a machine that supports
  1307. function keys, using @b[^XX] again places you in the @b(Function Keys)
  1308. buffer). Using @b(^XX) one last time cycles you back to the beginning
  1309. of the list.
  1310.  
  1311. If you have a large number of buffers to deal with, this cycling process
  1312. may be slow and inconvenient. The command @b{^XB} @i(select-buffer)
  1313. @index(select-buffer) allows you to specify the buffer you wish to be
  1314. switched to. When the command is entered, EMACS prompts, "Use buffer:". 
  1315. Simply enter the buffer name (NOT the file name), and that buffer will
  1316. then become the current buffer. If you type in part of the file name
  1317. and press the space bar, EMACS will attempt to complete the name from
  1318. the list of current buffers. If it succeeds, it will print the rest of
  1319. the name and you can hit <NL> to switch to that buffer. If EMACS beeps
  1320. the bell, there is no such buffer, and you may continue editing the name
  1321. on the command line.
  1322.  
  1323. Multiple buffer manipulation and editing is a complex activity, and you
  1324. will probably find it very inconvenient to re-save each buffer as you
  1325. modify it. The command @b{^X^B} @i(list-buffers) @index(list-buffers)
  1326. creates a new window that gives details about all the buffers currently
  1327. known to EMACS. Buffers that have been modified are identified by the
  1328. "buffer changed" indicator (an asterisk in the second column). You can
  1329. thus quickly and easily identify buffers that need to be saved to files
  1330. before you exit EMACS. The buffer window also provides other
  1331. information -- buffer specific modes, buffer size, and buffer name are
  1332. also listed. To close this window, simply type the close-windows
  1333. command, @b{^X1}. 
  1334.  
  1335. To delete any buffer, type @b{^XK} @i(delete-buffer)
  1336. @index(delete-buffer). EMACS prompts you "Kill buffer:". Enter the
  1337. buffer name you want to delete. As this is destructive command, EMACS
  1338. will ask for confirmation if the buffer was changed and not saved. 
  1339. Answer Y(es) or N(o). As usual @b{^G} cancels the command. 
  1340.  
  1341. @newpage
  1342. @heading(Chapter @value(chapter) Summary)
  1343.  
  1344. In Chapter @value(chapter) you learned how to manipulate buffers. 
  1345.  
  1346. @begin{verbatim}
  1347. @u(Key Binding        Keystroke               Effect)
  1348. next-buffer        @b(^X^X)    Switch to the next buffer in the
  1349.                     buffer list
  1350.  
  1351. select-buffer        @b(^XB)     Switch to a particular buffer
  1352.  
  1353. list-buffers        @b(^X^B)    List all buffers
  1354.  
  1355. delete-buffer        @b(^XK)     Delete a particular buffer if it
  1356.                     is off-screen
  1357. @end(verbatim)
  1358. @chapter(Modes)
  1359.  
  1360.     EMACS allows you to change the way it works in order to
  1361. customized it to the style of editing you are using. It does this by
  1362. providing a number of different @b(modes) @index(modes). These modes
  1363. can effect either a single buffer, or any new buffer that is created. 
  1364. To add a mode to the current buffer, type @b(^XM) @i(add-mode)
  1365. @index(add-mode). EMACS will then prompt you for the name of a mode to
  1366. add. When you type in a legal mode name, and type a <NL>, EMACS will
  1367. add the mode name to the list of current mode names in the mode line of
  1368. the current buffer. 
  1369.  
  1370.     To remove an existing mode, typing the @b(^X^M) @i(delete-mode)
  1371. @index(delete-mode) will cause EMACS to prompt you for the name of a
  1372. mode to delete from the current buffer. This will remove that mode from
  1373. the mode list on the current mode line.
  1374.  
  1375.     Global modes are the modes which are inherited by any new
  1376. buffers which are created. For example, if you wish to always do string
  1377. searching with character case being significant, you would want global
  1378. mode EXACT to be set so that any new files read in inherent the EXACT
  1379. mode. Global modes are set with the @b(M-M) @i(add-global-mode)
  1380. @index(add-global-mode) command, and unset with the @b(M-^M)
  1381. @i(delete-global-mode) @index(delete-global-mode) command. Also, the
  1382. current global modes are displayed in the first line of a
  1383. @b(^X^B) @i(list-buffers) @index(list-buffers) command.
  1384.  
  1385.     On machines which are capable of displaying colors,
  1386. @index(color) the mode commands can also set the background and
  1387. foreground character colors. Using @i(add-mode) or @i(delete-mode) with
  1388. a lowercase color will set the background color in the current window. 
  1389. An uppercase color will set the foreground color in the current window. 
  1390. Colors that EMACS knows about are: white, cyan, magenta, yellow, blue,
  1391. red, green, and black. If the computer you are running on does not have
  1392. eight colors, EMACS will attempt to make some intelligent guess at what
  1393. color to use when you ask for one which is not there. 
  1394.  
  1395. @section(ASAVE mode)@index(ASAVE mode)
  1396.  
  1397.     Automatic Save mode tells EMACS to automatically write out the
  1398. current buffer to its associated file on a regular basis. Normally this
  1399. will be every 256 characters typed into the file. The environment
  1400. variable $ACOUNT counts down to the next auto-save, and $ASAVE is the
  1401. value used to reset $ACOUNT after a save occurs. 
  1402.  
  1403. @section(CMODE mode)@index(CMODE mode)
  1404.  
  1405.     CMODE is useful to C programmers. When CMODE is active, EMACS
  1406. will try to assist the user in a number of ways. This mode is set
  1407. automatically with files that have a .c or .h extension. 
  1408.  
  1409.     The <NL> key will normally attempt to return the user to the
  1410. next line at the same level of indentation as the last non blank line,
  1411. unless the current line ends with a open brace ({) in which case the
  1412. new line will be further indented by one tab position.
  1413.  
  1414.     A close brace (}) will search for the corresponding open brace
  1415. and line up with it.
  1416.  
  1417.     A pound sign (#) with only leading white space will delete all
  1418. the white space preceding itself. This will always bring preprocessor
  1419. directives flush to the left margin.
  1420.  
  1421.     Whenever any close fence is typed, IE )]>}, if the matching open
  1422. fence is on screen in the current window, the cursor will briefly flash
  1423. to it, and then back. This makes balancing expressions, and matching
  1424. blocks much easier.
  1425.  
  1426. @section(CRYPT mode)@index(CRYPT mode)
  1427.  
  1428.     When a buffer is in CRYPT mode, @index(encryption) it is
  1429. encrypted whenever it is written to a file, and decrypted when it is
  1430. read from the file. The encryption key can be specified on the command
  1431. line with the -k switch, or with the @b(M-E) @i(set-encryption-key)
  1432. @index(set-encryption-key) command. If you attempt to read or write a
  1433. buffer in crypt mode and now key has not been set, EMACS will execute
  1434. @i(set-encryption-key) automatically, prompting you for the needed key. 
  1435. Whenever EMACS prompts you for a key, it will not echo the key to your
  1436. screen as you type it (IE make SURE you get it right when you set it
  1437. originally).
  1438.  
  1439.     The encryption algorithm used changes all characters into normal
  1440. printing characters, thus the resulting file is suitable for sending via
  1441. electronic mail. All version of MicroEMACS should be able decrypt the
  1442. resulting file regardless of what machine encrypted it. Also available
  1443. with EMACS is the stand alone program, MicroCRYPT, which can en/decrypt
  1444. the files produced by CRYPT mode in EMACS.
  1445.  
  1446. @section(EXACT mode)@index(EXACT mode)
  1447.  
  1448.     All string searches and replacements will take upper/lower case
  1449. into account. Normally the case of a string during a search or replace
  1450. is not taken into account.
  1451.  
  1452. @section(MAGIC mode)@index(MAGIC mode)
  1453.  
  1454.      In the MAGIC mode certain characters gain special meanings when
  1455. used in a search pattern. Collectively they are know as @index(regular
  1456. expressions) regular expressions, and a limited number of them are
  1457. supported in MicroEmacs. They grant greater flexibility when using the
  1458. search command. They have no affect on the incremental search
  1459. command. 
  1460.  
  1461.      The symbols that have special meaning in MAGIC mode are
  1462. ^, $, ., &, ?, *, +, [ (and ], used with it), and \.
  1463.  
  1464.      The characters ^ and $ fix the search pattern to the beginning and
  1465. end of line, respectively. The ^ character must appear at the beginning
  1466. of the search string, and the $ must appear at the end, otherwise they
  1467. lose their meaning and are treated just like any other character. For
  1468. example, in MAGIC mode, searching for the pattern "t$" would put the
  1469. cursor at the end of any line that ended with the letter 't'. Note that
  1470. this is different than searching for "t<NL>", that is, 't' followed by a
  1471. newline character. The character $ (and ^, for that matter) matches a
  1472. position, not a character, so the cursor remains at the end of the line. 
  1473. But a newline is a character that must be matched like any other
  1474. character, which means that the cursor is placed just after it - on the
  1475. beginning of the next line. 
  1476.  
  1477.      The character . has a very simple meaning -- it matches any single
  1478. character, except the newline. Thus a search for "bad.er" could match
  1479. "badger", "badder" (slang), or up to the 'r' of "bad error". 
  1480.  
  1481.      The character [ indicates the beginning of a character class. It
  1482. is similar to the 'any' character ., but you get to choose which
  1483. characters you want to match. The character class is ended with the
  1484. character ]. So, while a search for "ba.e" will match "bane", "bade",
  1485. "bale", "bate", et cetera, you can limit it to matching "babe" and
  1486. "bake" by searching for "ba[bk]e". Only one of the characters inside
  1487. the [ and ] will match a character. If in fact you want to match any
  1488. character except those in the character class, you can put a ^ as the
  1489. first character. It must be the first character of the class, or else
  1490. it has no special meaning. So, a search for [^aeiou] will match any
  1491. character except a vowel, but a search for [aeiou^] will match any vowel
  1492. or a ^.
  1493.  
  1494. If you have many characters in order, that you want to put in the
  1495. character class, you may use a dash (-) as a range character. So, [a-z]
  1496. will match any letter (or any lower case letter if EXACT mode is on),
  1497. and [0-9a-f] will match any digit or any letter 'a' through 'f', which
  1498. happen to be the characters for hexadecimal numbers. If the dash is at
  1499. the beginning or end of a character class, it is taken to be just a
  1500. dash. 
  1501.  
  1502.      The ? character indicates that the preceding character is optional.
  1503. The character may or may not appear in the matched string. For example,
  1504. a search for "bea?st" would match both "beast" and "best". If there is
  1505. no preceding charcter for ? to modify, it is treated as a normal
  1506. question mark character.
  1507.  
  1508.      The * character is known as closure, and means that zero or more
  1509. of the preceding character will match. If there is no preceding character,
  1510.  * has no special meaning and is treated as a normal asterisk. The
  1511. closure symbol will also have no special meaning if it is preceded by
  1512. the beginning of line symbol ^, since it represents a position, not a
  1513. character. 
  1514.  
  1515.      The notion of zero or more characters is important. If, for
  1516. example, your cursor was on the line
  1517.  
  1518. @quotation(This line is missing two vowels.)
  1519.  
  1520. and a search was made for "a*", the cursor would not move, because it is
  1521. guaranteed to match no letter 'a' , which satisfies the search
  1522. conditions. If you wanted to search for one or more of the letter 'a',
  1523. you could search for "aa*", which would match the letter a, then zero or
  1524. more of them. A better way, however, is to use the + character.
  1525.  
  1526.      The + character behaves in every respect like the * character, with
  1527. the exception that its minimum match range is one, not zero. Thus the
  1528. pattern "a+" is identical to "aa*".
  1529.  
  1530.      Under older versions of MicroEMACS, the closure symbols would not
  1531. operate on newlines. The current versions no longer have this restriction.
  1532.  
  1533.      The \ is the escape character. With the exception of groups, which
  1534. are explained below, the \ is used at those times when you want to be in
  1535. MAGIC mode, but also want a regular expression character to be just a
  1536. character. It turns off the special meaning of the character. So a
  1537. search for "it\." will search for a line with "it.", and not "it"
  1538. followed by any other character. Or, a search for "TEST\*+" would match
  1539. the word TEST followed by one or more asterisks. The escape character
  1540. will also let you put ^, -, or ] inside a character class with no
  1541. special side effects.
  1542.  
  1543.      The character pair \( represent the start of a group in a search
  1544. string. A group is ended by the character pair \). All characters
  1545. matched within the \( and \) are part of a numbered group, and may be
  1546. referenced with the &GROUP function, or with a \ followed by the group
  1547. number in the replacement string of @i(replace-string)
  1548. @index(replace-string) or the
  1549. @i(query-replace-string) @index(query-replace-string) commands. For
  1550. example, a search for "INDEX\([0-9]+\)", to be replaced by "getind(\1)"
  1551. would change
  1552.  
  1553. @quotation(indptr := INDEX42) to @quotation(indptr := getind(42)).
  1554.  
  1555.      There may be up to nine groups. Groups may be nested.
  1556.  
  1557.      The character & (ampersand) is a replacement character, and
  1558. represents all the characters which were matched by the search string. 
  1559. When used in the @b[M-R] @i(replace-string) @index(replace-string) or
  1560. the @b[M-^R]
  1561. @i(query-replace-string) @index(query-replace-string) commands, the &
  1562. will be substituted for the search string. 
  1563.  
  1564. @section(OVER mode)@index(OVER mode)
  1565.  
  1566.     OVER mode stands for overwrite mode. When in this mode, when
  1567. characters are typed, instead of simply inserting them into the file,
  1568. EMACS will attempt to overwrite an existing character past the point. 
  1569. This is very useful for adjusting tables and diagrams. 
  1570.  
  1571. @section(WRAP mode)@index(WRAP mode)
  1572.  
  1573.     Wrap mode is used when typing in continuous text. Whenever the
  1574. cursor is past the currently set fill column @index(fill column) (72 by
  1575. default) and the user types a space or a <NL>, the last word of the line
  1576. is brought down to the beginning of the next line. Using this, one just
  1577. types a continuous stream of words and EMACS automatically inserts <NL>s
  1578. at appropriate places.
  1579.  
  1580. @center(NOTE to programmers:)
  1581.  
  1582. @quotation{The EMACS variable $wraphook contains the name of the
  1583. function which executes when EMACS detects it is time to wrap. This is
  1584. set to the function @i(wrap-word) @index(wrap-word) by default, but can
  1585. be changed to activate different functions and macroes at wrap time.}
  1586.  
  1587. @section(VIEW mode)@index(VIEW mode)
  1588.  
  1589.     VIEW mode disables all commands which can change the current
  1590. buffer. EMACS will display an error message and ring the bell every
  1591. time you attempt to change a buffer in VIEW mode.
  1592. @newpage
  1593. @heading(Chapter @value(chapter) Summary)
  1594.  
  1595. In Chapter @value(chapter) you learned about modes and their effects.
  1596.  
  1597. @begin{verbatim}
  1598. @u(Key Binding        Keystroke               Effect)
  1599. add-mode        @b(^XM)     Add a mode to the current buffer
  1600.  
  1601. delete-mode        @b(^X^M)    Delete a mode from the current buffer
  1602.  
  1603. add-global-mode     @b(M-M)     Add a global mode to the
  1604.                     current buffer
  1605.  
  1606. delete-global-mode    @b(M-^M)    Delete a global mode from the
  1607.                     current buffer
  1608. @end(verbatim)
  1609. @chapter(Files)
  1610.  
  1611. A file is simply a collection of related data. In EMACS we are dealing
  1612. with text files -- named collections of text residing on a disk (or some
  1613. other storage medium). You will recall that the major entities EMACS
  1614. deals with are buffers. Disk-based versions of files are only active in
  1615. EMACS when you are reading into or writing out of buffers. As we have
  1616. already seen, buffers and physical files are linked by associated
  1617. file names. For example, the buffer "ch7.txt" which is associated with
  1618. the physical disk file "ch7.txt." You will notice that the file is
  1619. usually specified by the drive name or (in the case of a hard drive) a
  1620. path. Thus you can specify full file names in EMACS,
  1621.  
  1622. e.g. disk:\directories\filename.extension
  1623.  
  1624. If you do not specify a disk and directories, the default disk and the
  1625. current directory is used.
  1626.  
  1627. IMPORTANT -- If you do not explicitly save your buffer to a file, all your
  1628. edits will be lost when you leave EMACS (although EMACS will prompt you
  1629. when you are about to lose edits by exiting). In addition, EMACS does
  1630. not protect your disk-based files from overwriting when it saves files. 
  1631. Thus when you instruct EMACS to save a file to disk, it will create a
  1632. file if the specified file doesn't exist, or it will overwrite the
  1633. previously saved version of the file thus replacing it. Your old
  1634. version is gone forever. 
  1635.  
  1636. If you are at all unsure about your edits, or if (for any reason) you
  1637. wish to keep previous versions of a file, you can change the name of
  1638. the associated file with the command @b{^XN}
  1639. @i(change-file-name)@index(change-file-name). When this file is saved
  1640. to disk, EMACS will create a new physical file under the new name. The
  1641. earlier disk file will be preserved.
  1642.  
  1643. For example, let's load the file @b{fang.txt} into EMACS. Now, type
  1644. @b{^XN}. The EMACS command line prompts "Name:". Enter a new name
  1645. for the file -- say @b(new.txt) and press <NL>. The file will be
  1646. saved under the new filename, and your disk directory will show both
  1647. @b(fang.txt) and @b(new.txt).
  1648.  
  1649. An alternative method is to write the file directly to disk under a new
  1650. filename. Let's pull our "publish.txt" file into EMACS. To write this
  1651. file under another filename, type @b{^X^W}
  1652. @i(write-file)@index(writefile). EMACS will prompt you "write file:". 
  1653. Enter an alternate filename -- @b{desktop.txt}. Your file will be
  1654. saved as the physical file "desktop.txt".
  1655.  
  1656. Note that in the examples above, although you have changed the names of
  1657. the related files, the buffer names remain the same. However, when you
  1658. pull the physical file back into EMACS, you will find that the buffer
  1659. name now relates to the filename.
  1660.  
  1661. For example -- You are working with a buffer "fang.txt" with the related
  1662. file "fang.txt". You change the name of the file to "new.txt". EMACS
  1663. now shows you working with the buffer "fang.txt" and the related file
  1664. "new.txt". Now pull the file "new.txt" into EMACS. Notice that the
  1665. buffer name has now changed to "new.txt". 
  1666.  
  1667. If for any reason a conflict of buffer names occurs,(if you have files
  1668. of the same name on different drives for example) EMACS will prompt
  1669. you "use buffer:". Enter an alternative buffer name if you need to. 
  1670.  
  1671. For a list of file related commands (including some we`ve already
  1672. seen), see the summary page.
  1673. @newpage
  1674. @heading(Chapter @value(chapter) Summary)
  1675.  
  1676. In Chapter @value(chapter) you learned some of the more advanced
  1677. concepts of file naming and manipulation. The relationship between
  1678. files and buffers was discussed in some detail. 
  1679.  
  1680. @begin(verbatim)
  1681. @u(Key Binding    Keystroke    Effect)
  1682.  
  1683. save-file    @b{^X^S}    Saves contents of current buffer with
  1684.                 associated filename on default disk/
  1685.                 directory (if not specified)
  1686.  
  1687. write-file    @b{^X^W}    Current buffer contents will be
  1688.                 saved under specified name 
  1689.  
  1690. change-file-name
  1691.         @b{^XN}     The associated filename is changed
  1692.                 (or associated if not previously
  1693.                 specified) as specified
  1694.  
  1695. find-file    @b{^X^F}    Reads specified file into buffer and 
  1696.                 switches you to that buffer, or switches
  1697.                 to buffer in which the file has previously
  1698.                 been read
  1699.  
  1700. read-file    @b{^X^R}    Reads file into buffer thus overwriting
  1701.                 buffer contents. If file has already
  1702.                 been read into another buffer, you will
  1703.                 be switched to it
  1704.  
  1705. view-file    @b{^X^V}    The same as read-file except the buffer
  1706.                 is automatically put into VIEW mode thus 
  1707.                 preventing any changes from being made
  1708. @end{verbatim}
  1709. @chapter(Screen Formatting)
  1710.  
  1711. @section<Wrapping Text>
  1712.  
  1713. As we learned in the introduction, EMACS is not a word processor, but an
  1714. editor. Some simple formatting options are available however, although
  1715. in most cases they will not affect the appearance of the finished text
  1716. @index(wrapping text) when it is run through the formatter. We have
  1717. already encountered WRAP mode which wraps lines longer than a certain
  1718. length (default is 75 characters). You will recall that WRAP is enabled
  1719. by entering @b{^XM} and responding to the command line prompt with
  1720. @b{wrap}. 
  1721.  
  1722. You can also set your own wrap margin with the command @b{^XF}
  1723. @i(set-fill-column) @index(set-fill-column). Notice EMACS responds
  1724. "[Fill column is 1]." Now try typing some text. You'll notice some very
  1725. strange things happening -- your text wraps at every word!! This effect
  1726. occurs because the set wrap margin command must be preceded by a
  1727. numeric argument or EMACS sets it to the first column. Thus any text
  1728. you type that extends past the first column will wrap at the most
  1729. convenient line break. 
  1730.  
  1731. To reset the wrap column to 72 characters, press the @b{<META>} key and
  1732. enter 72. EMACS will respond "Arg: 72". Now press @b<^XF>. EMACS
  1733. will respond "[Fill column is 72]". Your text will again wrap at the
  1734. margin you've been using up to this point.
  1735.  
  1736. @section<Reformatting Paragraphs>
  1737.  
  1738. After an intensive editing session, you may find that you have
  1739. paragraphs containing lines of differing lengths. Although this
  1740. disparity will not affect the formatted text, aesthetic and technical
  1741. concerns may make it desirable to have consistent paragraph blocks on
  1742. the screen. If you are in WRAP mode, you can reformat a paragraph with
  1743. the command @b{M-Q} @i(fill-paragraph) @index(fill-paragraph). This
  1744. command 'fills' the current paragraph reformatting it so all the lines
  1745. are filled and wrap logically.
  1746.  
  1747. @section<Changing Case>
  1748.  
  1749. There may be occasions when you find it necessary to change the case of
  1750. the text you've entered. EMACS allows you to change the case of even
  1751. large amounts of text with ease. Let's try and convert a few of the
  1752. office traditionalists to the joy of word processing. Type in the
  1753. following text:
  1754.  
  1755. @quotation{Throw away your typewriter and learn to use a word processor. 
  1756. Word processing is relatively easy to learn and will increase your
  1757. productivity enormously. Enter the Computer Age and find out just how
  1758. much fun it can be!!}
  1759.  
  1760. Let's give it a little more impact by capitalizing the first four words. 
  1761. The first step is to define the region of text just as you would if you
  1762. were doing an extensive deletion. Set the mark at the beginning of the
  1763. paragraph with @b{M-<space>} @i(set-mark) and move the cursor to the
  1764. space beyond "typewriter." Now enter @b{^X^U} @i(case-region-upper). 
  1765. Your text should now look like this:
  1766.  
  1767. @quotation{THROW AWAY YOUR TYPEWRITER and learn to use a word processor. 
  1768. Word processing is relatively easy to learn and will increase your
  1769. productivity enormously. Enter the Computer Age and find out just how
  1770. much fun it can be!!}
  1771.  
  1772. If you want to change the text back to lower case, type @b{^X^L}
  1773. @i(case-region-lower) @index(case-region-lower). You can also
  1774. capitalize individual words. To capitalize the word "fun", position the
  1775. cursor in front of the word and type @b{M-U} @i(case-word-upper)
  1776. @index(case-word-upper). The word is now capitalized. To change it
  1777. ck to lower case, move the cursor back to the beginning of the word
  1778. and type @b{M-L} @i(case-word-lower) @index(case-word-lower). 
  1779.  
  1780. You may also capitalize individual letters in EMACS. The command
  1781. @b{M-C} @i(case-word-capitalize) @index(case-word-capitalize)
  1782. capitalizes the first letter after the point. This command would
  1783. normally be issued with the cursor positioned in front of the first
  1784. letter of the word you wish to capitalize. If you issue it in the
  1785. middle of a word, you can end up with some strAnge looking text. 
  1786.  
  1787. @section<Tabs>
  1788.  
  1789. Unless your formatter is instructed to take screen text literally (as
  1790. MicroSCRIBE does in the 'verbatim' environment for example), tabs in
  1791. EMACS generally affect screen formatting only. 
  1792.  
  1793. When EMACS is first started, it sets the default tab to every eighth
  1794. column. As long as you stay with default, every time you press the tab
  1795. key a tab character, @b(^I) is inserted. This character, like other
  1796. control characters, is invisible -- but it makes a subtle and
  1797. significant difference to your file and editing. 
  1798.  
  1799. For example, in default mode, press the tab key and then type the word
  1800. @b{Test}. "Test" appears at the eighth column. Move your cursor to the
  1801. beginning of the word and delete the backward character. The word
  1802. doesn't move back just one character, but flushes to the left margin. 
  1803. The reason for this behavior is easily explained. In tab default, EMACS
  1804. inserts a 'real' tab character when you press the tab key. This
  1805. character is inserted at the default position, but NO SPACES are
  1806. inserted between the tab character and the margin (or previous tab
  1807. character). As you will recall, EMACS only recognizes characters (such
  1808. as spaces or letters) and thus when the tab character is removed, the
  1809. text beyond the tab is flushed back to the margin or previous tab mark.
  1810.  
  1811. This situation changes if you alter the default configuration. The
  1812. default value may be changed by entering a numeric argument before
  1813. pressing the tab key. As we saw earlier, pressing the @b{META} key and
  1814. entering a number allows you to specify how EMACS performs a given
  1815. action. In this case, let's specify an argument of 10 and hit the tab
  1816. key. 
  1817.  
  1818. Now hit the tab key again and type @b{Test}. Notice the word now
  1819. appears at the tenth column. Now move to the beginning of the word and
  1820. delete the backward character. "Test" moves back by one character. 
  1821.  
  1822. EMACS behaves differently in these circumstances because the @b(^I)
  1823. @index(tab handling) @i(handle-tab) @index(handle-tab) function deals
  1824. with tabbing in two distinct ways. In default conditions, or if the
  1825. numeric argument of zero is used, @i(handle-tab) inserts a true tab
  1826. character. If, however, a non-zero numeric argument is specified,
  1827. @i(handle-tab) inserts the correct number of spaces needed to position
  1828. the cursor at the next specified tab position. It does NOT insert the
  1829. single tab character and hence any editing functions should take account
  1830. of the number of spaces between tabbed columns.
  1831.  
  1832. The distance which a true tab character moves the cursor can be
  1833. modified by changing the value of the $hardtab environment variable. 
  1834. Initially set to 8, this will determine how far each tab stop is placed
  1835. from the previous one. (Use the ^XA @i(set)@index(set) command to set
  1836. the value of an environment variable).
  1837.  
  1838. Many times you would like to take text which has been created using
  1839. the tab character and change it to use just spaces. The command
  1840. @b(^X^D) @i(detab-region) @index(detab-region) changes any tabs 
  1841. in the currently selected region into the right number of spaces so
  1842. the text does not change. This is very useful for times when the file
  1843. must be printed or transferred to a machine which does not understand
  1844. tabs. 
  1845.  
  1846. Also, the inverse command, @b(^X^E) @i(entab-region)
  1847. @index(entab-region) changes multiple spaces to tabs where possible. 
  1848. This is a good way to shrink the size of large documents, especially
  1849. with data tables. Both of these commands can take a numeric argument
  1850. which will be interpreted as the number of lines to en/detab. 
  1851.  
  1852. Another function, related to those above is provided for by the @b(^X^T)
  1853. @i(trim-region)@index(trim-region) when invoked will delete any trailing
  1854. white space in the selected region. A preceding numeric argument will do
  1855. this for that number of lines.
  1856. @newpage
  1857. @heading(Chapter @value(chapter) Summary)
  1858.  
  1859. In Chapter @value(chapter) introduced some of the formatting features of
  1860. EMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
  1861. some detail. The commands in the following table were covered in the
  1862. chapter. 
  1863.  
  1864. @begin{verbatim}
  1865.  
  1866. @u(Key Binding        Keystroke            Effect)
  1867. add-mode/WRAP        @b{^XM}[WRAP]    Add wrap mode to current buffer
  1868.  
  1869. delete-mode/WRAP    @b{^X^M}[WRAP]    Remove wrap mode from current buffer
  1870.  
  1871. set-fill-column     @b{^XF}     Set fill column to given numeric
  1872.                     argument  
  1873.  
  1874. fill-paragraph        @b{M-Q}     Logically reformats the current
  1875.                     paragraph
  1876.  
  1877. case-word-upper     @b{M-U}     Text from point to end of the
  1878.                     current word is changed to uppercase
  1879.  
  1880. case-word-lower     @b{M-L}     Text from point to end of the 
  1881.                     current word is changed to lowercase
  1882.  
  1883. case-word-capitalize    @b{M-C}     First word (or letter) after the
  1884.                     point is capitalized
  1885.  
  1886. case-region-upper    @b{^X^U}    The current region is uppercased
  1887.  
  1888. case-region-lower    @b{^X^L}    The current region is lowercased
  1889.  
  1890. handle-tab        @b{^I}        Tab interval is set to the given
  1891.                     numeric argument
  1892.  
  1893. entab-region        @b(^X^E)    Changes multiple spaces to tabs
  1894.                     characters where possible
  1895.  
  1896. detab-region        @b(^X^D)    Changes tab characters to the
  1897.                     appropriate number of spaces
  1898.  
  1899. trim-region        @b(^X^T)    Trims white space from the end
  1900.                     of the lines in the current region
  1901. @end{verbatim}
  1902. @chapter(Access to the Outside World)
  1903.  
  1904.     EMACS has the ability to interface to other programs and the
  1905. environment of the computer outside of itself. It does this through a
  1906. series of commands that allow it to talk to the computer's @b(command
  1907. processor) @index(command processor) or @b(shell) @index(shell). Just
  1908. what this is varies between different computers. Under MSDOS or PCDOS
  1909. this is the @b(command.com) @index(command.com) command processor. 
  1910. Under UNIX it is the @b(csh) @index(cshell) shell. On the Atari ST is
  1911. can be the Mark Williams @b(MSH) or the Beckmeyer shell. In each case,
  1912. it is the part of the computer's operating system that is responsible
  1913. for determining what programs are executed, and when. 
  1914.  
  1915.     The @b(^X!) @i(shell-command) @index(shell-command) command
  1916. prompts the user for a command line to send out to the shell to execute.
  1917. This can be very useful for doing file listings and changing the
  1918. current directory or folder. EMACS gives control to the shell, which
  1919. executed the command, and then types @b([END]) and waits for the user to
  1920. type a character before redrawing the screen and resuming editing. If
  1921. the @i(shell-command) command is used from within the macro language,
  1922. there is no pause.
  1923.  
  1924.     @b(^X@@) @i(pipe-command) @index(pipe-command) command allows
  1925. EMACS to execute a shell command, and if the particular computer allows
  1926. it, send the results into a buffer which is automatically displayed on
  1927. the screen. The resulting buffer, called "command" can be manipulated
  1928. just like any other editing buffer. Text can be copied out of it or
  1929. rearranged as needed. This buffer is originally created in @b(VIEW) mode,
  1930. so remember to @b(^X^Mview<NL>) in order to change it.
  1931.  
  1932.     Many computers provide tools which will allow you to @b(filter)
  1933. @index(filter) text, making some modifications to it along the way. A
  1934. very common tool is the @b(SORT) program which accepts a file, sorts
  1935. it, and prints the result out. The EMACS command, @b(^X#)
  1936. @i(filter-buffer)@index(filter-buffer) sends the current buffer through
  1937. such a filter. Therefore, if you wished to sort the current buffer on
  1938. a system which supplied a sort filter, you would type @b(^X#sort<NL>). 
  1939. You can also create your own filters by writing programs and utilities
  1940. which read text from the keyboard and display the results. EMACS will
  1941. use any of these which would normally be available from the current
  1942. shell.
  1943.  
  1944.     If you would like to execute another program directly, without
  1945. the overhead of an intervening shell, you can use the @b(^X$)
  1946. @i(execute-program) @index(execute-program) command. It will prompt you
  1947. for an external program and its arguments and attempt to execute it. 
  1948. Like when EMACS looks for command files, EMACS will look first in the
  1949. HOME directory, then down the execute PATH, and finally in the current
  1950. directory for the named program. On some systems, it will automatically
  1951. tack the proper extension on the file name to indicate it is a program.
  1952. On some systems that don't support this function, @b(^X$) will be
  1953. equivalent to @b(^X!) @i(shell-command).
  1954.  
  1955.     Sometimes, you would like to get back to the shell and execute
  1956. other commands, without losing the current contents of EMACS. The
  1957. @b(^XC) @i(i-shell) @index(i-shell) command shells out of EMACS,
  1958. leaving EMACS in the computer and executing another command shell. Most
  1959. systems would allow you to return to EMACS with the "exit" command. 
  1960.  
  1961.     @i(On some systems, mainly advanced versions of UNIX, you can
  1962. direct EMACS to "go into the background" with the @b(^XD) suspend-emacs
  1963. @index(suspend-emacs) command. This places EMACS in the background
  1964. returning you to the original command shell. EMACS can then be returned
  1965. to at any time with the "fg" foreground command.)
  1966. @newpage
  1967. @heading(Chapter @value(chapter) Summary)
  1968.  
  1969. In Chapter @value(chapter) introduced different ways to access the
  1970. computers shell or command processor from within EMACS. The commands
  1971. in the following table were covered in the chapter. 
  1972.  
  1973. @begin{verbatim}
  1974.  
  1975. @u(Key Binding        Keystroke            Effect)
  1976. execute-program     @b(^X$)     Execute an external program
  1977.                     directly
  1978.  
  1979. filter-command        @b(^X#)     Send the current buffer through
  1980.                     a shell filter
  1981.  
  1982. i-shell         @b(^XC)     Escape to a new shell
  1983.  
  1984. pipe-command        @b(^X@@)    Send the results of an external
  1985.                     shell command to a buffer
  1986.  
  1987. shell-command        @b(^X!)     Execute one shell command
  1988.  
  1989. suspend-emacs        @b(^XD)     Place EMACS in the background
  1990.                     (some UNIX systems only)
  1991. @end{verbatim}
  1992. @chapter(Keyboard Macroes)
  1993.  
  1994.     In many applications, you may need to repeat a series of
  1995. characters or commands frequently. For example, a paper may require the
  1996. frequent repetition of a complex formula or a long name. You may also
  1997. have a series of EMACS commands that you invoke frequently. Keyboard
  1998. macroes offer a convenient method of recording and repeating these
  1999. commands. 
  2000.  
  2001.     Imagine, for example, you are writing a scholarly paper on
  2002. @i{Asplenium platyneuron}, the spleenwort fern. Even the dedicated
  2003. botanist would probably find it a task bordering on the agonizing to
  2004. type @i{Asplenium platyneuron} frequently throughout the paper. An
  2005. alternative method is 'record' the name in a keyboard macro. Try it
  2006. yourself.
  2007.  
  2008.     The command @b{^X(} @i(begin-macro) @index(begin-macro) starts
  2009. recording the all the keystrokes and commands you input. After you've
  2010. typed it, enter @b{Asplenium platyneuron}. To stop recording, type
  2011. @b{^X)} @i(end-macro) @index(end-macro). EMACS has stored all the
  2012. keystrokes between the two commands. To repeat the name you've stored,
  2013. just enter @b{^XE} @i(execute-macro) @index(execute-macro), and the
  2014. name "Asplenium platyneuron" appears. You can repeat this action as
  2015. often as you want, and of course as with any EMACS command, you may
  2016. precede it with a numerical argument to repeat it many times.
  2017.  
  2018.     Because EMACS records keystrokes, you may freely intermix
  2019. commands and text. Unfortunately, you can only store one macro at a
  2020. time. Thus, if you begin to record another macro, the previously defined
  2021. macro is lost. Be careful to ensure that you've finished with one macro
  2022. before defining another. If you have a series of commands that you would
  2023. like to 'record' for future use, use the procedure facilities detailed
  2024. in chapter @ref(macroes).
  2025. @newpage
  2026. @heading(Chapter @value(chapter) Summary)
  2027.  
  2028. Chapter @value(chapter) covered keyboard macroes. You learned how to
  2029. record keystrokes and how to repeat the stored sequence. 
  2030.  
  2031. @begin{verbatim}
  2032. @u(Key Binding        Keystroke        Effect)
  2033.  
  2034. start-macro        @b{^X(}     Starts recording all keyboard input
  2035.  
  2036. end-macro        @b{^X)}     Stops recording keystrokes for macro
  2037.  
  2038. execute-macro        @b{^XE}     Entire sequence of recorded
  2039.                     keystrokes is replayed
  2040. @end{verbatim}
  2041. @chapter(MicroEMACS Procedures)
  2042. @tag(macroes)
  2043.     Procedures, or macroes, are programs that are used to customize
  2044. the editor and to perform complicated editing tasks. They may be stored
  2045. in files or buffers and may be executed using an appropriate command, or
  2046. bound to a particular keystroke. Portions of the standard start-up file
  2047. are implemented via procedures, as well as the built in help system. The
  2048. @b(M-^E) @i(run) @index(run) command causes named procedures to be executed.
  2049. The @i(execute-file) @index(execute-file) command allows you to execute
  2050. a procedure stored in a disk file, and the @i(execute-buffer)
  2051. @index(execute-buffer) command allows you to execute a procedure stored
  2052. in a buffer. Procedures are stored for easy execution by executing files
  2053. that contain the store-procedure command. 
  2054.  
  2055.     In a command file, the @i(store-procedure)
  2056. @index(store-procedure) command takes a string argument which is the
  2057. name of a procedure to store. These procedures than can be executed with
  2058. the @b(M-^E) @i(run) @index(run) command. Also, giving the name of a
  2059. stored procedure within another procedure will executed that named
  2060. procedure as if it had been called up with the @i(run) command.
  2061.  
  2062.     Some fairly length examples of MicroEMACS procedures can be seen
  2063. by examining the standard files that come with EMACS. The @b(emacs.rc)
  2064. @index(emacs.rc) file (called @b[.emacsrc]@index[.emacsrc]) under UNIX)
  2065. is the MicroEMACS command file which is executed when EMACS is normally
  2066. run. It contains a number of different stored procedures along with the
  2067. lines to setup and display the Function key window @index(function key
  2068. window) and to call up other procedures and command files using function
  2069. keys.
  2070.  
  2071.     There are many different aspects to the language within
  2072. MicroEMACS. Editor commands are the various commands that manipulate
  2073. text, buffers, windows, et cetera, within the editor. Directives are
  2074. commands which control what lines get executed within a macro. Also
  2075. there are various types of variables. Environmental variables both
  2076. control and report on different aspects of the editor. User variables
  2077. hold string values which may be changed and inspected. Buffer variables
  2078. allow text to be placed into variables. Interactive variable allow the
  2079. program to prompt the user for information. Functions can be used to
  2080. manipulate all these variables. 
  2081.  
  2082. @section(Constants)
  2083.  
  2084.     All constants and variable contents in EMACS are stored as
  2085. strings of characters. Numbers are stored digit by digit as characters.
  2086. This allows EMACS to be "typeless", not having different variables types
  2087. be legal in different contexts. This has the disadvantage of forcing the
  2088. user to be more careful about the context of the statements variables
  2089. are placed in, but in turn gives them more flexibility in where they
  2090. can place variables. Needless to say, this also allows EMACS's expression
  2091. evaluator to be both concise and quick.
  2092.  
  2093.     Wherever statements need to have arguments, it is legal to place
  2094. constants. A constant is a double quote character, followed by a string
  2095. of characters, and terminated by another double quote character. To
  2096. represent various special characters within a constant, the tilde (~)
  2097. @index(tilde, special use) character is used. The character following the
  2098. tilde is interpreted according to the following table:
  2099.  
  2100. @begin(verbatim)
  2101. @u(Sequence    Result)
  2102. ~n            EMACS newline character (breaks lines)
  2103. ~r        ^M    carriage return
  2104. ~l        ^J    linefeed
  2105. ~~        ~    tilde
  2106. ~b        ^H    backspace
  2107. ~f        ^L    formfeed
  2108. ~t        ^I    tab
  2109. ~"        "    quote
  2110. @end(verbatim)
  2111.  
  2112.     Any character not in the table which follows a tilde will be
  2113. passed unmodified. This action is similar to the @b(^Q)
  2114. @i(quote-character) command available from the keyboard. 
  2115.  
  2116.     EMACS may use different characters for line terminators on
  2117. different computers. The ~n combination will always get the proper line
  2118. terminating sequence for the current system.
  2119.  
  2120.     The double quotes around constants are not needed if the
  2121. constant contains no internal white space and it also does not happen to
  2122. meet the rules for any other EMACS commands, directives, variables, or
  2123. functions. This is reasonable useful for numeric constants.
  2124.  
  2125. @section(Variables)
  2126.  
  2127.     Variables in MicroEMACS procedures can be used to return values
  2128. within expressions, as repeat counts to editing commands, or as text to
  2129. be inserted into buffers and messages. The value of these variables is
  2130. set using the set @b(^XA) command. For example, to set the current fill
  2131. column to 64 characters, the following macro line would be used:
  2132.  
  2133.     set $fillcol 64
  2134.  
  2135.     or to have the contents of @b(%name) inserted at the point in the
  2136. current buffer, the command to use would be:
  2137.  
  2138.     insert-string %name
  2139.  
  2140. @subsection(Environmental Variables)
  2141.  
  2142.     "What good is a quote if you can't change it?"
  2143.  
  2144.     These variables are used to change different aspects of the way
  2145. the editor works. Also they will return the current settings if used as
  2146. part of an expression. All environmental variable names begin with a
  2147. dollar sign ($) and are in lower case.
  2148.  
  2149. @begin(description)
  2150. @index($acount)
  2151. $acount@\The countdown of inserted characters until the next save-file.
  2152.  
  2153. @index($asave)
  2154. $asave@\The number of inserted characters between automatic file-saves
  2155. in ASAVE mode.
  2156.  
  2157. @index($bufhook)
  2158. $bufhook@\The function named in this variable is run when a buffer is
  2159. entered. It can be used to implement modes which are specific to a
  2160. paricular file or file type.
  2161.  
  2162. @index($cbflags)
  2163. $cbflags@\Current buffer attribute flags (See appendix G for details).
  2164.  
  2165. @index($cbufname)
  2166. $cbufname@\Name of the current buffer.
  2167.  
  2168. @index($cfname)
  2169. $cfname@\File name of the current buffer.
  2170.  
  2171. @index($cmdhook)
  2172. $cmdhook@\Name of function to run before accepting a command. This is
  2173. by default set to @i(nop).
  2174.  
  2175. @index($cmode)
  2176. $cmode@\Integer containing the mode of the current buffer. (See Appendix F
  2177. for values).
  2178.  
  2179. @index($curchar)
  2180. $curchar@\Ascii value of the character currently at the point.
  2181.  
  2182. @index($curcol)
  2183. $curcol@\Current column of point in current buffer.
  2184.  
  2185. @index($curline)
  2186. $curline@\Current line of point in current buffer.
  2187.  
  2188. @index($curwidth)
  2189. $curwidth@\Number of columns used currently.
  2190.  
  2191. @index($curwind)
  2192. $curwind@\Current window number.
  2193.  
  2194. @index($cwline)
  2195. $cwline@\Current display line in current window.
  2196.  
  2197. @index($debug)
  2198. $debug@\Flag to trigger macro debugging.
  2199.  
  2200. @index($deskcolor)
  2201. $deskcolor@\Color to use for current desktop, default to BLACK.
  2202.  
  2203. @index($diagflag)
  2204. $diagflag@\If set to TRUE, diagonal dragging of text and mode lines is
  2205. enabled. If FALSE, text and modelines can only be dragged horizontally
  2206. or vertically at one time.
  2207.  
  2208. @index($discmd)
  2209. $discmd@\Controls the echoing of command prompts. Default is TRUE.
  2210.  
  2211. @index($disinp)
  2212. $disinp@\Controls the echoing of input at the command prompts. Default
  2213. is TRUE.
  2214.  
  2215. @index($disphigh)
  2216. $disphigh@\If set to TRUE, high-bit characters (single byte characters
  2217. that are greater than 127 in value) will be displayed in a
  2218. pseudo-control format. The characters "^!" will lead off the sequence,
  2219. followed by the character stripped of its high bit. Default is FALSE.
  2220.  
  2221. @index($exbhook)
  2222. $exbhook@\This variable holds the name of a function or macro which is
  2223. run whenever you are switching out of a buffer.
  2224.  
  2225. @index($fcol)
  2226. $fcol@\The current line position being displayed in the first column of
  2227. the current window.
  2228.  
  2229. @index($fillcol)
  2230. $fillcol@\Current fill column.
  2231.  
  2232. @index($flicker)
  2233. $flicker@\Flicker Flag set to TRUE if IBM CGA set to FALSE for most
  2234. others.
  2235.  
  2236. @index($fmtlead)
  2237. $fmtlead@\lists all formatter command leadin characters. Lines beginning
  2238. with these characters will be considered the beginning of paragraphs.
  2239.  
  2240. @index($gflags)
  2241. $gflags@\Global flags controlling some EMACS internal functions (See
  2242. appendix G for details).
  2243.  
  2244. @index($gmode)
  2245. $gmode@\Global mode flags. (See Appendix F for values).
  2246.  
  2247. @index($hardtab)
  2248. $hardtab@\Number of spaces between hard tab stops. Normally 8, this can
  2249. be used to change indentation only within the editor.@index(tabs)
  2250.  
  2251. @index($hjump)
  2252. $hjump@\The number in here tells EMACS how many columns to scroll the
  2253. screen horizontally when a horizontal scroll is required.
  2254.  
  2255. @index($hscroll)
  2256. $hscroll@\This flag determines if EMACS will scroll the entire current
  2257. window horizontally, or just the current line. The default value, TRUE,
  2258. results in the entire current window being shifted left and right when
  2259. the cursor goes off the edge of the screen.
  2260.  
  2261. @index($kill)
  2262. $kill@\This contains the first 127 characters currently in the kill
  2263. buffer and can be used to set the contents of the kill buffer.
  2264.  
  2265. @index($language)
  2266. $language@\[READ ONLY]Contains the name of the language which the
  2267. current EMACS's message will display. (Currently EMACS is available in
  2268. English, French, Spanish, Latin, Portuguese, Dutch, German, and Pig Latin).
  2269.  
  2270. @index($lastkey)
  2271. $lastkey@\[READ ONLY]Last keyboard character typed.
  2272.  
  2273. @index($lastmesg)
  2274. $lastmesg@\[READ ONLY]Contains the text of the last message which
  2275. emacs wrote on the command line.
  2276.  
  2277. @index($line)
  2278. $line@\The current line in the current buffer can be retrieved and
  2279. set with this environment variable.
  2280.  
  2281. @index($lterm)
  2282. $lterm@\Character(s) to write as a line terminator when writing a file
  2283. to disk. Default is null, which causes a '\n' character to be written.
  2284. Not all operating systems support this.
  2285.  
  2286. @index($lwidth)
  2287. $lwidth@\[READ ONLY]Returns the number of characters in the current line.
  2288.  
  2289. @index($match)
  2290. $match@\[READ ONLY]Last string matched in a search.
  2291.  
  2292. @index($modeflag)
  2293. $modeflag@\Determines if mode lines are currently displayed.
  2294.  
  2295. @index($msflag)
  2296. $msflag@\If TRUE, the mouse (if present) is active. If FALSE, no mouse
  2297. cursor is displayed, and no mouse actions are taken.@index(mouse)
  2298.  
  2299. @index($numwind)
  2300. $numwind@\The number of windows displayed.
  2301.  
  2302. @index($oldcrypt)
  2303. $oldcrypt@\Use the old method of encryption (which had a bug in it). 
  2304. Default is FALSE.  This variable was dropped from EMACS with version 3.12.
  2305.  
  2306. @index($orgrow)
  2307. $orgrow@\The desktop row position of current screen.
  2308.  
  2309. @index($orgcol)
  2310. $orgcol@\The desktop column position of current screen.
  2311.  
  2312. @index($pagelen)
  2313. $pagelen@\The number of screen lines used currently.
  2314.  
  2315. @index($palette)
  2316. $palette@\A string used to control the palette register settings on
  2317. graphics versions. The usual form consists of groups of three octal
  2318. digits setting the red, green, and blue levels.@index(color pallette)
  2319.  
  2320. @index($paralead)
  2321. $paralead@\A string containing all paragraph start characters.
  2322.  
  2323. @index($pending)
  2324. $pending@\[READ ONLY]A flag used to determine if there are user keystrokes
  2325. waiting to be processed.
  2326.  
  2327. @index($popflag)
  2328. $popflag@\Use pop-up windows. Default is TRUE.
  2329.  
  2330. @index($posflag)
  2331. $posflag@\Display the line and column position on the modeline. Default
  2332. is FALSE.
  2333.  
  2334. @index($progname)
  2335. $progname@\[READ ONLY]Always contains the string "MicroEMACS" for
  2336. standard MicroEMACS. Could be something else if EMACS is incorporated
  2337. as part of someone else's program.
  2338.  
  2339. @index($ram)
  2340. $ram@\The amount of remaining memory if MicroEMACS was compiled with
  2341. RAMSIZE set. A debugging tool.
  2342.  
  2343. @index($readhook)
  2344. $readhook@\This variable holds the name of a function to execute
  2345. whenever a file is read into EMACS. Normally, using the standard
  2346. @b(emacs.rc) file, this is bound to a function which places EMACS into
  2347. CMODE if the extension of the file read is .c or .h.
  2348.  
  2349. @index($region)
  2350. $region@\Contains the string of the current region. It will truncate at
  2351. the stringsize limit, 255.
  2352.  
  2353. @index($replace)
  2354. $replace@\The current replace pattern used in replace commands.
  2355.  
  2356. @index($rval)
  2357. $rval@\This contains the return value from the last subprocess which was
  2358. invoked from EMACS.
  2359.  
  2360. @index($scrname)
  2361. $scrname@\The current screen name.
  2362.  
  2363. @index($search)
  2364. $search@\The current search pattern used in search and replace commands.
  2365.  
  2366. @index($searchpnt)
  2367. $searchpnt@\Set the placement of the of the cursor on a successful
  2368. search match. $searchpnt = 0 (the default), causes the cursor to be
  2369. placed at the end of the matched text on forward searches, and at the
  2370. beginning of the text on reverse searches. $searchpnt = 1 causes the
  2371. cursor to be placed at the the beginning of the matched text regardless
  2372. of the search direction, while $searchpnt = 2 causes the cursor to be
  2373. placed at the end.
  2374.  
  2375. @index($seed)
  2376. $seed@\Integer seed of the random number generator.
  2377.  
  2378. @index($softtab)
  2379. $softtab@\Number of spaces inserted by EMACS when the handle-tab command
  2380. (which is normally bound to the TAB key) is invoked.@index(tabs)
  2381.  
  2382. @index($sres)
  2383. $sres@\Current screen resolution (CGA, MONO, EGA or VGA on the IBM-PC
  2384. driver. LOW, MEDIUM, HIGH or DENSE on the Atari ST1040, NORMAL on most
  2385. others).@index(screen resolution)
  2386.  
  2387. @index($ssave)
  2388. $ssave@\A variable which flags EMACS's method of saving files. If set to
  2389. TRUE, EMACS will write all files out to a temporary file, delete the
  2390. original, then rename the temporary to the old file name. The default
  2391. value of this is TRUE.
  2392.  
  2393. @index($sscroll)
  2394. $sscroll@\When set to TRUE, EMACS will smoothly scroll windows one line
  2395. at a time when cursoring off the ends of the current window. Default is
  2396. FALSE.
  2397.  
  2398. @index($status)
  2399. $status@\[READ ONLY]Status of the success of the last command (TRUE or
  2400. FALSE). This is usually used with !force to check on the success of a
  2401. search, or a file operation. 
  2402.  
  2403. @index($sterm)
  2404. $sterm@\This is the character used to terminate search string inputs.
  2405. The default for this is the last key bound to @i(meta-prefix).
  2406.  
  2407. @index($target)
  2408. $target@\Current target for line moves (setting this fools EMACS into
  2409. believing the last command was a line move).
  2410.  
  2411. @index($time)
  2412. $time@\[READ ONLY]Contains a string corresponding to the current date
  2413. and time. Usually this is in a form similar to "Mon May 09 10:10:58 1988".
  2414. Not all operating systems will support this.
  2415.  
  2416. @index($timeflag)
  2417. $timeflag@\Flag to determine if the time of day is displayed on the
  2418. modeline. Default is FALSE. The time is updated only after a keystroke.
  2419.  
  2420. @index($tpause)
  2421. $tpause@\Controls the length of the pause to display a matched fence
  2422. when the current buffer is in CMODE and a close fence has been typed.
  2423.  
  2424. @index($version)
  2425. $version@\[READ ONLY]Contains the current MicroEMACS version number.
  2426.  
  2427. @index($wchars)
  2428. $wchars@\When set, MicroEMACS uses the characters listed in it to
  2429. determine if it is in a word or not. If it is not set (the default),
  2430. the characters it uses are the upper and lower case letters, and the
  2431. underscore.
  2432.  
  2433. @index($wline)
  2434. $wline@\Number of display lines in current window.
  2435.  
  2436. @index($wraphook)
  2437. $wraphook@\This variable contains the name of an EMACS function which is
  2438. executed when a buffer is in WRAP mode and it is time to wrap. By
  2439. default this is bound to @i(wrap-word).
  2440.  
  2441. @index($writehook)
  2442. $writehook@\This variable contains the name of an EMACS function or
  2443. macro which is invoked whenever EMACS attempts to write a file out to
  2444. disk. This is executed before the file is written, allowing you to
  2445. process a file on the way out.
  2446.  
  2447. @index($xpos)
  2448. $xpos@\The column the mouse was at the last mouse button press.
  2449.  
  2450. @index($yankflag)
  2451. $yankflag@\Controls the placement of the cursor after a yank command or
  2452. an insert. When $yankflag is FALSE (the default), the cursor is placed
  2453. at the end of the yanked or inserted text. When it is TRUE, the cursor
  2454. remains at the start of the text.
  2455.  
  2456. @index($ypos)
  2457. $ypos@\The line which the mouse was on during the last mouse button press.
  2458. @end(description)
  2459.  
  2460. @subsection(User variables)
  2461.  
  2462.     User variables allow you to store strings and manipulate them.
  2463. These strings can be pieces of text, numbers (in text form), or the
  2464. logical values @b(TRUE) and @b(FALSE). These variables can be combined,
  2465. tested, inserted into buffers, and otherwise used to control the way
  2466. your macroes execute. At the moment, up to 512 user variables may be in
  2467. use in one editing session. All users variable names must begin with a
  2468. percent sign (%) and may contain any printing characters. Only the first
  2469. 10 characters are significant (IE differences beyond the tenth character
  2470. are ignored). Most operators will truncate strings to a length of 128
  2471. characters. 
  2472.  
  2473. @subsection(Buffer Variables)
  2474.  
  2475.     Buffer variables are special in that they can only be queried
  2476. and cannot be set. What buffer variables are is a way to take text from
  2477. a buffer and place it in a variable. For example, if I have a buffer by
  2478. the name of RIGEL2, and it contains the text:
  2479.  
  2480. @begin(verbatim)
  2481. @begin(group)
  2482.     Richmond
  2483.     Lafayette
  2484.     <*>Bloomington        (where <*> is the current point)
  2485.     Indianapolis
  2486.     Gary
  2487.     =* MicroEMACS 3.12 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  2488. @end(group)
  2489. @end(verbatim)
  2490.  
  2491.     and within a command I reference #rigel2, like:
  2492.  
  2493.     insert-string #rigel2
  2494.  
  2495.     MicroEMACS would start at the current point in the RIGEL2
  2496. buffer and grab all the text up to the end of that line and pass that
  2497. back. Then it would advance the point to the beginning of the next line.
  2498. Thus, after our last command executes, the string "Bloomington" gets
  2499. inserted into the current buffer, and the buffer RIGEL2 now looks like
  2500. this:
  2501.  
  2502. @begin(verbatim)
  2503. @begin(group)
  2504.     Richmond
  2505.     Lafayette
  2506.     Bloomington
  2507.     <*>Indianapolis     (where <*> is the current point)
  2508.     Gary
  2509.     =* MicroEMACS 3.12 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  2510. @end(group)
  2511. @end(verbatim)
  2512.  
  2513.     as you have probably noticed, a buffer variable consists of the
  2514. buffer name, preceded by a pound sign (#).
  2515.  
  2516. @subsection(Interactive variables)
  2517.  
  2518.     Interactive variables are actually a method to prompt the user
  2519. for a string. This is done by using an at sign (@@) followed either with
  2520. a quoted string, or a variable containing a string. The string is the
  2521. placed on the bottom line, and the editor waits for the user to type in
  2522. a string. Then the string typed in by the users is returned as the
  2523. value of the interactive variable. For example:
  2524.  
  2525. @begin(verbatim)
  2526.     set %quest "What file? "
  2527.     find-file @@%quest
  2528. @end(verbatim)
  2529.  
  2530.     will ask the user for a file name, and then attempt to find it.
  2531. Note also that complex expressions can be built up with these
  2532. operators, such as:
  2533.  
  2534. @verbatim(set %default "file1"
  2535. @@&cat &cat "File to decode[" %default "]: ")
  2536.  
  2537.     which prompts the user with the string:
  2538.  
  2539.     File to decode[file1]:
  2540.  
  2541. @section(Functions)
  2542.  
  2543.     Functions can be used to act on variables in various ways. 
  2544. Functions can have one, two, or three arguments. These arguments will
  2545. always be placed after the function on the current command line. For
  2546. example, if we wanted to increase the current fill column by two, using
  2547. emacs's set (^XA) command, we would write:
  2548.  
  2549. @begin(group)
  2550. @begin(verbatim)
  2551.     set $fillcol &add $fillcol 2
  2552.      \    \      \      \     \____second operand
  2553.       \     \    \      \_________first operand
  2554.        \      \     \_______________function to execute
  2555.         \       \_____________________variable to set
  2556.          \___________________________set (^XA) command
  2557. @end(verbatim)
  2558. @end(group)
  2559.  
  2560.     Function names always begin with the ampersand (&) character,
  2561. and are only significant to the first three characters after the
  2562. ampersand. Functions will normal expect one of three types of
  2563. arguments, and will automatically convert types when needed. Different
  2564. argument types include:
  2565.  
  2566. @begin(description)
  2567. <num>@\an ascii string of digits which is interpreted as a numeric value. 
  2568. Any string which does not start with a digit or a minus sign (-) will be
  2569. considered zero. 
  2570.  
  2571. <str>@\An arbitrary string of characters. At the moment, strings are
  2572. limited to 128 characters in length. 
  2573.  
  2574. <log>@\A logical value consisting of the string "TRUE" or "FALSE". 
  2575. Numeric strings will also evaluate to "FALSE" if they are equal to zero,
  2576. and "TRUE" if they are non-zero. Arbitrary text strings will have the
  2577. value of "FALSE". 
  2578. @end(description)
  2579.  
  2580.     A list of the currently available functions follows. Functions
  2581. are always used in lower case, the uppercase letters in the function
  2582. table are the short form of the function (IE &div for ÷).
  2583.  
  2584. @begin(verbatim)
  2585. Numeric Functions:    (returns <num>)
  2586.  
  2587. &ADD        <num> <num>    Add two numbers
  2588. &SUB        <num> <num>    Subtract the second number from the first
  2589. &TIMes        <num> <num>    Multiply two numbers
  2590. &DIVide     <num> <num>    Divide the first number by the second
  2591.                 giving an integer result
  2592. &MOD        <num> <num>    Return the reminder of dividing the
  2593.                 first number by the second
  2594. &NEGate     <neg>        Multiply the arg by -1
  2595. &LENgth     <str>        Returns length of string
  2596. &SINdex     <str1> <str2>    Finds the position of <str2> within
  2597.                 <str1>. Returns zero if not found.
  2598. &ASCii        <str>        Return the ascii code of the first
  2599.                 character in <str>
  2600. &RND        <num>        Returns a random integer between 1 and <num>
  2601. &ABS        <num>        Returns the absolute value of <num>
  2602. &BANd        <num> <num>    Bitwise AND function
  2603. &BOR        <num> <num>    Bitwise OR function
  2604. &BXOr        <num> <num>    Bitwise XOR function
  2605. &BNOt        <num>        Bitwise NOT function
  2606.  
  2607. String manipulation functions:    (returns <str>)
  2608.  
  2609. &CAT        <str> <str>    Concatenate the two strings to form one
  2610. &LEFt        <str> <num>    return the <num> leftmost characters
  2611.                 from <str>
  2612. &RIGht        <str> <num>    return the <num> rightmost characters
  2613.                 from <str>
  2614. &MID        <str> <num1> <num2>
  2615.                 Starting from <num1> position in <str>,
  2616.                 return <num2> characters.
  2617. &REVerse    <str>        return a string with reversed-ordered
  2618.                 characters
  2619. &UPPer        <str>        Uppercase <str>
  2620. &LOWer        <str>        Lowercase <str>
  2621. &CHR        <num>        return a string with the character
  2622.                 represented by ascii code <num>
  2623. >C                returns a string of characters
  2624.                 containing a EMACS command input from
  2625.                 the user
  2626. >K                return a string containing a single
  2627.                 keystroke from the user
  2628. &ENV        <str>        If the operating system is capable, this
  2629.                 returns the environment string associated
  2630.                 with <str>
  2631. &BIND        <str>        return the function name bound to the
  2632.                 keystroke <str>
  2633. &XLATE        <str1> <str2> <str3>
  2634. &FINd        <str>        Find the named file <str> along the
  2635.                 path and return its full file specification
  2636.                 or an empty string if none exists
  2637. &TRIM        <str>        Trim the trailing whitespace from a string
  2638.  
  2639. Logical Testing functions:    (returns <log>)
  2640.  
  2641. &NOT        <log>        Return the opposite logical value
  2642. &AND        <log1> <log2>    Returns TRUE if BOTH logical arguments
  2643.                 are TRUE
  2644. &OR        <log1> <log2>    Returns TRUE if either argument
  2645.                 is TRUE
  2646. &EQUal        <num> <num>    If <num> and <num> are numerically
  2647.                 equal, return TRUE
  2648. &LESs        <num1> <num2>    If <num1> is less than <num2>, return
  2649.                 TRUE.
  2650. &GREater    <num1> <num2>    If <num1> is greater than <num2>, return
  2651.                 TRUE.
  2652. &SEQual     <str1> <str2>    If the two strings are the same, return
  2653.                 TRUE.
  2654. &SLEss        <str1> <str2>    If <str1> is less alphabetically than
  2655.                 <str2>, return TRUE.
  2656. &SGReater    <str1> <str2>    If <str1> is alphabetically greater than
  2657.                 or equal to <str2>, return TRUE.
  2658. &EXIst        <str>        Does the named file <str> exist?
  2659.  
  2660. &ISNum        <num>        Is the given argument a legitimate number?
  2661.  
  2662. Special Functions:
  2663.  
  2664. &GROup        <num>        Return group <num> as set by a MAGIC
  2665.                 mode search.
  2666.  
  2667. &SUPper        <str1> <str2>    Translate the first char in <str1> to
  2668.                 the first char in <str2> when uppercasing.
  2669.  
  2670. &SLOwer        <str1> <str2>    Translate the first char in <str1> to
  2671.                 the first char in <str2> when lowercasing.
  2672.  
  2673. &INDirect    <str>        Evaluate <str> as a variable.
  2674. @end(verbatim)
  2675.  
  2676.     This last function deserves more explanation. The &IND function
  2677. evaluates its argument, takes the resulting string, and then uses it as
  2678. a variable name. For example, given the following code sequence:
  2679.  
  2680. @begin(verbatim)
  2681.     ; set up reference table
  2682.  
  2683.     set %one    "elephant"
  2684.     set %two    "giraffe"
  2685.     set %three    "donkey"
  2686.  
  2687.     set %index "%two"
  2688.     insert-string &ind %index
  2689. @end(verbatim)
  2690.  
  2691.     the string "giraffe" would have been inserted at the point in
  2692. the current buffer. This indirection can be safely nested up to about
  2693. 10 levels.
  2694.  
  2695. @section(Directives)
  2696.  
  2697.     Directives are commands which only operate within an executing
  2698. procedure, IE they do not make sense as a single command. As such, they
  2699. cannot be called up singly or bound to keystroke. Used within command
  2700. files, they control what lines are executed and in what order.
  2701.  
  2702.     Directives always start with the exclamation mark (!) character
  2703. and must be the first non-white space placed on a line. Directives
  2704. executed interactively (via the execute-command-line command) will be
  2705. ignored. 
  2706.  
  2707. @subsection(!ENDM Directive)
  2708.  
  2709.     This directive is used to terminate a procedure or macro being
  2710. stored. For example, if a file is being executed contains the text:
  2711.  
  2712. @begin(verbatim)
  2713.     ;    Read in a file in view mode, and make the window red
  2714.  
  2715.     store-procedure get-red-viewed-file
  2716.         find-file @@"File to view: "
  2717.         add-mode "view"
  2718.         add-mode "red"
  2719.     !endm
  2720.  
  2721.     print "[Consult procedure has been loaded]"
  2722. @end(verbatim)
  2723.  
  2724.     only the lines between the store-macro command and the !ENDM
  2725. directive are stored in procedure get-red-viewd-file. Both named
  2726. procedures and numbered macroes (via the @i(store-macro) command) should
  2727. be terminated with this directive.
  2728.  
  2729. @subsection(!FORCE Directive)
  2730.  
  2731.     When MicroEMACS executes a procedure, if any command fails, the
  2732. procedure is terminated at that point. If a line is preceded by a !FORCE
  2733. directive, execution continues whether the command succeeds or not. For
  2734. example:
  2735.  
  2736. @begin(verbatim)
  2737.     ;    Merge the top two windows
  2738.  
  2739.     save-window        ;remember what window we are at
  2740.     1 next-window        ;go to the top window
  2741.     delete-window        ;merge it with the second window
  2742.     !force restore-window    ;This will continue regardless
  2743.     add-mode "red"
  2744. @end(verbatim)
  2745.     Often this is used together with the $status environment
  2746. variable to test if a command succeeded. For example:
  2747. @begin(verbatim)
  2748.     set %seekstring @"String to Find: "
  2749.     !force search-forward %seekstring
  2750.     !if &seq $status TRUE
  2751.         print "Your string is Found"
  2752.     !else
  2753.         print "No such STRING!"
  2754.     !endif
  2755. @end(verbatim)
  2756.  
  2757. @subsection(!IF, !ELSE, and !ENDIF Directives)
  2758.  
  2759.     This directive allows statements only to be executed if a
  2760. condition specified in the directive is met. Every line following the
  2761. !IF directive, until the first !ELSE or !ENDIF directive, is only
  2762. executed if the expression following the !IF directive evaluates to a
  2763. TRUE value. For example, the following commands creates the portion of a
  2764. text file automatically. (yes believe me, this will be easier to
  2765. understand then that last explanation....)
  2766.  
  2767. @begin(verbatim)
  2768.     !if &sequal %curplace "timespace vortex"
  2769.         insert-string "First, rematerialize~n"
  2770.     !endif
  2771.     !if &sequal %planet "earth"    ;If we have landed on earth...
  2772.         !if &sequal %time "late 20th century"  ;and we are then
  2773.             write-message "Contact U.N.I.T."
  2774.         !else
  2775.             insert-string "Investigate the situation....~n"
  2776.             insert-string "(SAY 'stay here Sara')~n"
  2777.         !endif
  2778.     !else
  2779.         set %conditions @@"Atmosphere conditions outside? "
  2780.         !if &sequal %conditions "safe"
  2781.             insert-string &cat "Go outside......" "~n"
  2782.             insert-string "lock the door~n"
  2783.         !else
  2784.             insert-string "Dematerialize..try somewhen else"
  2785.             newline
  2786.         !endif
  2787.     !endif
  2788. @end(verbatim)
  2789.  
  2790. @subsection(!GOTO Directive)
  2791.  
  2792.     Flow can be controlled within a MicroEMACS procedure using the
  2793. !GOTO directive. It takes as an argument a label. A label consists of a
  2794. line starting with an asterisk (*) and then an alphanumeric label. Only
  2795. labels in the currently executing procedure can be jumped to, and trying
  2796. to jump to a non-existing label terminates execution of a procedure. For
  2797. example:
  2798.  
  2799. @begin(verbatim)
  2800.     ;Create a block of DATA statements for a BASIC program
  2801.  
  2802.         insert-string "1000 DATA "
  2803.         set %linenum 1000
  2804.  
  2805.     *nxtin
  2806.         update-screen        ;make sure we see the changes
  2807.         set %data @@"Next number: "
  2808.         !if &equal %data 0
  2809.             !goto finish
  2810.         !endif
  2811.  
  2812.         !if &greater $curcol 60
  2813.             2 delete-previous-character
  2814.             newline
  2815.             set %linenum &add %linenum 10
  2816.             insert-string &cat %linenum " DATA "
  2817.         !endif
  2818.  
  2819.         insert-string &cat %data ", "
  2820.         !goto nxtin
  2821.  
  2822.     *finish
  2823.  
  2824.         2 delete-previous-character
  2825.         newline
  2826. @end(verbatim)
  2827.  
  2828. @subsection(!WHILE and !ENDWHILE Directives)
  2829.  
  2830.     This directive allows you to set up repetitive tasks easily and
  2831. efficiently. If a group of statements need to be executed while a
  2832. certain condition is true, enclose them with a while loop. For example,
  2833.  
  2834. @begin(verbatim)
  2835.     !while &less $curcol 70
  2836.         insert-string &cat &cat "[" #stuff "]"
  2837.     !endwhile
  2838. @end(verbatim)
  2839.  
  2840.     places items from buffer "item" in the current line until the
  2841. cursor is at or past column 70. While loops may be nested and can
  2842. contain and be the targets of !GOTOs with no ill effects. Using a while
  2843. loop to enclose a repeated task will run much faster than the
  2844. corresponding construct using !IFs.
  2845.  
  2846. @subsection(!BREAK Directive)
  2847.  
  2848.     This lets you abort out of the most executing currently inner
  2849. while loop, regardless of the condition. It is often used to abort
  2850. processing for error conditions. For example:
  2851.  
  2852. @begin(verbatim)
  2853. ;    Read in files and substitute "begining" with "beginning"
  2854.  
  2855.     set %filename #list
  2856.     !while ¬ &seq %filename "<end>"
  2857. !force        find-file %filename
  2858.         !if &seq $status FALSE
  2859.             write-message "[File read error]"
  2860.             !break
  2861.         !endif
  2862.         beginning-of-file
  2863.         replace-string "begining" "beginning"
  2864.         save-file
  2865.         set %filename #list
  2866.     !endwhile
  2867. @end(verbatim)
  2868.  
  2869.     This while loop will process files until the list is exhausted
  2870. or there is an error while reading a file.
  2871.  
  2872. @subsection(!RETURN Directive)
  2873.  
  2874.     The !RETURN Directive causes the current procedure to exit,
  2875. either returning to the caller (if any) or to interactive mode. For
  2876. example:
  2877.  
  2878. @begin(verbatim)
  2879.     ;    Check the monitor type and set %mtyp
  2880.  
  2881.     !if &sres "CGA"
  2882.         set %mtyp 1
  2883.         !return
  2884.     !else
  2885.         set %mtyp 2
  2886.     !endif
  2887.  
  2888.     insert-string "You are on a MONOCHROME machine!~n"
  2889. @end(verbatim)
  2890. @chapter(Debugging MicroEMACS Procedures)
  2891.  
  2892.     @index(debugging)@index($debug)When developing new procedures,
  2893. it is very convenient to be able to trace their execution to discover
  2894. errors. The $debug environment variable enables procedure debugging.
  2895. While this variable is TRUE, emacs will stop at each line it intends to
  2896. execute and allow you to view it, and issue a number of different
  2897. commands to help determine how the procedure is executing.
  2898.  
  2899.     For example, we will step through the procedure which toggles
  2900. the function key window off. The first thing to do, is to set $debug,
  2901. using the @b(^XA) @i(set) command. Type ^XA and emacs will prompt you on
  2902. the command line with "Variable to set: ". Type in "$debug" and press
  2903. the enter key. Emacs will then ask "Value: ". Type in "TRUE" (in capital
  2904. letters) and press the enter key.
  2905.  
  2906.     While macro debugging is enabled (as it is now) emacs will
  2907. report each time a variable is assigned a value, by displaying the
  2908. variable and its value on the command line. Right now,
  2909.  
  2910. @flushleft{((($debug <- TRUE)))}
  2911.  
  2912.     appears on the command line to tell you that $debug now has been
  2913. assigned the value of TRUE. Press the space bar to continue.
  2914.  
  2915.     Now, lets try to debug a macro. Press function key 5 which
  2916. normally toggles the function key window. The first thing that appears
  2917. is:
  2918.  
  2919. @flushleft{<<<[Macro 01]:!if %rcfkeys>>>}
  2920.  
  2921.     At this point, emacs is waiting for a command. It is prepared
  2922. to see if the user variable %rcfkeys is TRUE, and execute some lines if
  2923. they are. Suppose we want to see the value of this variable, type the
  2924. letter "e" to evaluate an expression. Emacs will prompt with "EXP: ". 
  2925. Type "%rcfkeys" followed by the enter key. Emacs should then respond
  2926. with "TRUE" to indicate that the function key window is currently on
  2927. screen.
  2928.  
  2929.     Press the space bar to allow the !if directive to execute. 
  2930. Emacs will decide that it is TRUE, and then display the next command to
  2931. execute.
  2932.  
  2933. @flushleft{<<<[Macro 01]:!goto rcfoff>>>}
  2934.  
  2935.     Notice emacs tells us what procedure we are currently executing
  2936. (in this case, the macro bound to execute-macro-1). Press the space bar
  2937. again to execute the !goto directive.
  2938.  
  2939. @flushleft{<<<[Macro 01]:save-window>>>}
  2940.  
  2941.     Emacs is saving the position of the current window so that it
  2942. can attempt to return to it after it has brought up the function key window.
  2943.  
  2944. [...THIS CHAPTER IS NOT FINISHED...]
  2945. @chapter(Key Bindings, What they are and why)
  2946.  
  2947.     One of the features which makes MicroEMACS very adaptable is its
  2948. ability to use different keystrokes to execute different commands. The
  2949. process of changing the particular command a key invokes is called
  2950. @i(rebinding)@index(rebinding). This allows us to make the editor
  2951. look like other popular editors and programs.
  2952.  
  2953.     Each command in MicroEMACS has a name which is used for binding
  2954. purposes. For example, the command to move the cursor down one page is
  2955. called @i(next-line) and is normally bound to the ^N key. If you
  2956. decided that you also wanted to use the ^D key to move the cursor down
  2957. one line, you would use the M-K @i(bind-to-key)@index(bind-to-key)
  2958. command. EMACS would respond with ": bind-to-key " on the command line
  2959. and allow you to type in a command name. Then type in the name of the
  2960. command  you want to change, in this case @i(next-line),
  2961. followed by the <NL> key. EMACS will then wait for you to type in the
  2962. keys you want to activate the named function. Type a single ^D. From
  2963. now on, typing ^D will cause EMACS to move down one line, rather than
  2964. its original function of deleting characters.
  2965.  
  2966.     To find out the name of a command, consult the list of
  2967. valid EMACS commands in Appendix B. Also, you can use the ^X?
  2968. @i(describe-key)@index(describe-key) command to look up the name of a
  2969. command. Type ^X? and then the key to use that command, and EMACS will
  2970. show you the name of the command.
  2971.  
  2972.     After you have experimented with changing your key bindings, you
  2973. may decide that you want to change some bindings permanently. To have
  2974. EMACS rebind keys to your pleasure each time you start EMACS, you can
  2975. add statements to the end of your startup file (@b(emacs.rc) or
  2976. @b(.emacsrc) depending on the system). For example,
  2977.  
  2978. bind-to-key next-line ^D
  2979.  
  2980.     Notice, that control D character in the startup file is
  2981. represented visibly as an uparrow key followed by a capital D. To know
  2982. how to represent any keys you want to bind, use the @i(describe-key)
  2983. command on the key, and use the sequence that is displayed.
  2984.  
  2985. bind-to-key split-current-window FN1
  2986.  
  2987.     This example would make function key 1 activate the command
  2988. that splits the current window in two. 
  2989.  
  2990.     EMACS will let you define a large number of keys, but will report 
  2991. "Binding table FULL!" when it runs out of space to bind keys. Normally 
  2992. EMACS will allow up to 512 key bindings (including approx. 300 originally 
  2993. bound keys).
  2994.  
  2995.     If you want to get a current listing of all the commands and
  2996. the keys bound to them, use the @i(describe-bindings)
  2997. @index(describe-bindings) command. Notice, that this command is not
  2998. bound to any keys!
  2999.  
  3000.     There are some @index(key bindings, declined) key bindings
  3001. that cannot be made without special precautions. Alternative bindings
  3002. for ^X, META, ^G, and ^U (which bind respectively to ctlx-prefix,
  3003. meta-prefix, abort-command, and universal-argument) must be made before
  3004. re-binding ^X, META, ^G, or ^U. The reason is to protect the innocent
  3005. user from losing the prefix and other commands inadvertantly.
  3006.  
  3007. @appendix(MicroEMACS Command Line Switches and Startup Files)
  3008.  
  3009. @index(startup files)
  3010.     When EMACS first executes, it always searches for a file,
  3011. called @b(.emacsrc) @i(under most UNIX systems) or @b(emacs.rc) @i(on
  3012. most other systems) @index(emacs.rc) @index(.emacsrc) which it will
  3013. execute as EMACS macroes before it reads in the named source files. This
  3014. file normally contains EMACS macroes to bind the function keys to
  3015. useful functions and load various useful macroes. The contents of this
  3016. file will probably vary from system to system and can be modified by the
  3017. user as desired.
  3018.  
  3019.     When searching for this file, EMACS looks for it in this order. 
  3020. First, it attempts to find a definition for "@b(HOME)" in the
  3021. environment. It will look in that directory first. Then it searches
  3022. all the directories listed in the "@b(PATH)" environment variable. Then
  3023. it looks through a list of predefined standard directories which vary
  3024. from system to system. Finally, failing all of these, it looks in the
  3025. current directory. This is also the same method EMACS uses to look up
  3026. any files to execute, and to find it's help file @b(EMACS.HLP). 
  3027. @index(PATH environment variable) @index(HOME environment variable)
  3028. @index(Help File)
  3029.  
  3030. @index(command line)
  3031. @index(switches)
  3032.     On computers that call up EMACS via a command line process, such
  3033. as MSDOS and UNIX, there are different things that can be added to the
  3034. command line to control the way EMACS operates. These can be switches,
  3035. which are a dash ('-') followed by a letter, and possible other
  3036. parameters, or a startup file specifier, which is an at sign '@@'
  3037. followed by a file name.
  3038.  
  3039. @begin(description)
  3040. @@<file>@\This causes the named file to be executed instead of the
  3041. standard emacs.rc file before emacs reads in any other files. More than
  3042. one of these can be placed on the command line, and they will be
  3043. executed in the order that they appear. 
  3044.  
  3045. -C@\The following source files on the command line can be changed (as
  3046. opposed to being in VIEW mode). This is mainly used to cancel the
  3047. effects of the -v switch used previously in the same command line.
  3048.  
  3049. -E@\This flag causes emacs to automatically run the startup file
  3050. "error.cmd" instead of emacs.rc. This is used by various C compilers for
  3051. error processing (for example, Mark Williams C). @index(error parsing)
  3052.  
  3053. -G<num>@\Upon entering EMACS, position the cursor at the <num> line of
  3054. the first file.
  3055.  
  3056. -I<var> <value>@\Initialize an EMACS variable with <value>. This can be
  3057. useful to force EMACS to start in a particular mode. (For example,
  3058. invoke EMACS with "emacs -i$sres VGA foo.bar" to edit file foo.bar
  3059. in VGA 50 line mode on an IBM-PC).
  3060.  
  3061. -K<key>@\This key tells emacs to place the source files in CRYPT
  3062. @index(CRYPT mode) mode and read it in using <key> as the encryption
  3063. key. If no key is listed immediately after the -K switch, EMACS will
  3064. prompt for a key, and not echo it as it is typed. 
  3065.  
  3066. -R@\This places EMACS in "restricted mode"@index(restricted mode)
  3067. @index(BBS) where any commands allowing the user to read or write any
  3068. files other than the ones listed on the command line are disabled. Also
  3069. all commands allowing the user access to the operating system are
  3070. disabled. This makes EMACS very useful as a "safe" environment for use
  3071. within other applications and especially used as a remote editor for a
  3072. BBS or electronic bulletin board system.
  3073.  
  3074. -S<string>@\After EMACS is started, it automatically searches for
  3075. <string> in the first source file.
  3076.  
  3077. -V@\This tells EMACS that all the following sources files on the command
  3078. line should be in VIEW mode to prevent any changes being made to them.
  3079. @end(description)
  3080. @appendix(Command Completion)
  3081.  
  3082.     Some versions of MicroEMACS will allow you to abbrieviate buffer
  3083. names, command names and file names as you enter them. To use this,
  3084. type in the first few characters of the name you wish, and then hit
  3085. either the space bar, the META key or the TAB key. MicroEMACS will then
  3086. attempt to look at the list of all the availible names and if there is
  3087. only one which will fit, it will choose that name. If there are several
  3088. names that quailify, as many characters as are common to ALL of them
  3089. will be entered. If there are no possible matches, the bell will ring
  3090. to indicate MicroEMACS can not complete the command.
  3091.  
  3092.     For example, if you have several files in your current directory
  3093. with the following names:
  3094.  
  3095. @begin(verbatim)
  3096.     prog1.c
  3097.     prog1.obj
  3098.     prog1.exe
  3099.     prog1.doc
  3100.     program.one
  3101.     project.one
  3102.     test.c
  3103.     tes
  3104. @end(verbatim)
  3105.  
  3106.     and you enter the @b(^X^F) @i(find-file) command, if you type
  3107. 'p' and then hit the space bar, EMACS will respond by typing the 'r'
  3108. that is common to all the above file names begining with 'p'. If you
  3109. then type 'ogr' and hit the tab key, EMACS will respond with 'am.one'
  3110. and automatically hit the enter key for you.
  3111.  
  3112.     If you were to instead type an 'a' and hit the space bar, EMACS
  3113. will beep, informing you that there is no possible match.
  3114.  
  3115.     If you type a 'te' and hit the space bar, EMACS will then type
  3116. the following 's', but it will not automatically enter it because it is
  3117. possible you mean to get to the test.c file.
  3118.  
  3119.     Buffer name, and command name completion is available in all
  3120. versions of MicroEMACS. File name completion is available on UNIX
  3121. BSD4.3, the Atari ST, the AMIGA and under MSDOS.
  3122. @appendix(MicroEMACS Commands)
  3123.  
  3124.     Below is a complete list of the commands in EMACS, the keys
  3125. normally used to do the command, and what the command does. Remember,
  3126. on some computers there may also be additional ways of using a command
  3127. (cursor keys and special function keys for example). 
  3128.  
  3129. @begin(verbatim)
  3130. @u(Command            Binding     Meaning)
  3131. abort-command         ^G    This allows the user to abort out of any
  3132.                 command that is waiting for input
  3133.  
  3134. add-mode         ^XM    Add a mode to the current buffer
  3135.  
  3136. add-global-mode      M-M    Add a global mode for all new buffers
  3137.  
  3138. append-file         ^X^A    Write a buffer to the end of a file
  3139.  
  3140. apropos          M-A    List out commands whose name contains
  3141.                 the string specified
  3142.  
  3143. backward-character     ^B    Move one character to the left
  3144.  
  3145. begin-macro         ^X(    Begin recording a keyboard macro
  3146.  
  3147. beginning-of-file     M-<    Move to the beginning of the file in
  3148.                 the current buffer
  3149.  
  3150. beginning-of-line     ^A    Move to the beginning of the current line
  3151.  
  3152. bind-to-key         M-K    Bind a key to a function
  3153.  
  3154. buffer-position      ^X=    List the position of the cursor in the
  3155.                 current window on the command line
  3156.  
  3157. case-region-lower     ^X^L    Make a marked region all lower case
  3158.  
  3159. case-region-upper     ^X^U    Make a marked region all upper case
  3160.  
  3161. case-word-capitalize     M-C    Capitalize the following word
  3162.  
  3163. case-word-lower      M-L    Lower case the following word
  3164.  
  3165. case-word-upper      M-U    Upper case the following word
  3166.  
  3167. change-file-name     ^XN    Change the name of the file in the
  3168.                 current buffer
  3169.  
  3170. change-screen-size    (none)    Change the number of lines of the screen
  3171.                 currently being used
  3172.  
  3173. change-screen-width    (none)    Change the number of columns of the
  3174.                 screen currently being used
  3175.  
  3176. clear-and-redraw     ^L    Clear the physical screen and redraw it
  3177.  
  3178. clear-message-line    (none)    Clear the command line
  3179.  
  3180. copy-region         M-W    Copy the currently marked region into
  3181.                 the kill buffer
  3182.  
  3183. count-words         M-^C    Count how many words, lines and
  3184.                 characters are in the current marked region
  3185.  
  3186. ctlx-prefix         ^X    Change the key used as the ^X prefix
  3187.  
  3188. cycle-screens         A-C    Bring the rearmost screen to front
  3189.  
  3190. delete-blank-lines     ^X^O    Delete all blank lines around the cursor
  3191.  
  3192. delete-buffer         ^XK    Delete a buffer which is not being
  3193.                 currently displayed in a window
  3194.  
  3195. delete-mode         ^X^M    Turn off a mode in the current buffer
  3196.  
  3197. delete-global-mode     M-^M    Turn off a global mode
  3198.  
  3199. delete-next-character     ^D    Delete the character following the cursor
  3200.  
  3201. delete-next-word     M-D    Delete the word following the cursor
  3202.  
  3203. delete-other-windows     ^X1    Make the current window cover the entire
  3204.                 screen
  3205.  
  3206. delete-previous-character^H    Delete the character to the left of the
  3207.                 cursor
  3208.  
  3209. delete-previous-word     M-^H    Delete the word to the left of the cursor
  3210.  
  3211. delete-screen         A-D    Delete a screen
  3212.  
  3213. delete-window         ^X0    Remove the current window from the screen
  3214.  
  3215. describe-bindings    (none)    Make a list of all legal commands
  3216.  
  3217. describe-functions    (none)    Make a list of all legal functions
  3218.  
  3219. describe-variables    (none)    Make a list of all environment
  3220.                 and user variables
  3221.  
  3222. describe-key         ^X?    Describe what command is bound to a
  3223.                 keystroke sequence
  3224.  
  3225. detab-region         ^X^D    Change all tabs in a region to the
  3226.                 equivalent spaces
  3227.  
  3228. display         ^XG    Prompts the user for a variable and
  3229.                 displays its current value
  3230.  
  3231. dump-variables         none    Places into a buffer the current values
  3232.                 of all environment and user variables
  3233.  
  3234. end-macro         ^X)    stop recording a keyboard macro
  3235.  
  3236. end-of-file         M->    Move cursor to the end of the current buffer
  3237.  
  3238. end-of-line         ^E    Move to the end of the current line
  3239.  
  3240. end-of-word        (none)    Move the point just past the end of
  3241.                 the current word
  3242.  
  3243. entab-region         ^X^E    Change multiple spaces to tabs where
  3244.                 possible
  3245.  
  3246. exchange-point-and-mark  ^X^X    Move cursor to the last marked spot,
  3247.                 make the original position be marked
  3248.  
  3249. execute-buffer        (none)    Execute a buffer as a macro
  3250.  
  3251. execute-command-line    (none)    Execute a line typed on the command
  3252.                 line as a macro command
  3253.  
  3254. execute-file        (none)    Execute a file as a macro
  3255.  
  3256. execute-macro         ^XE    Execute the keyboard macro (play back
  3257.                 the recorded keystrokes)
  3258. execute-macro-<n>    (none)    Execute numbered macro <N> where <N> is
  3259.                 an integer from 1 to 40
  3260.  
  3261. execute-named-command     M-X    Execute a command by name
  3262.  
  3263. execute-procedure     M-^E    Execute a procedure by name
  3264.  
  3265. execute-program     ^X$    Execute a program directly (not through
  3266.                 an intervening shell)
  3267.  
  3268. exit-emacs         ^X^C    Exit EMACS. If there are unwritten,
  3269.                 changed buffers EMACS will ask to confirm
  3270.  
  3271. fill-paragraph         M-Q    Fill the current paragraph
  3272.  
  3273. filter-buffer         ^X#    Filter the current buffer through an
  3274.                 external filter
  3275.  
  3276. find-file         ^X^F    Find a file to edit in the current window
  3277.  
  3278. find-screen         A-F    Bring the named screen to front,
  3279.                 creating it if needed
  3280.  
  3281. forward-character     ^F    Move cursor one character to the right
  3282.  
  3283. goto-line         M-G    Goto a numbered line
  3284.  
  3285. goto-mark         M-^G    Goto a numbered mark
  3286.  
  3287. goto-matching-fence     M-^F    Goto the matching fence
  3288.  
  3289. grow-window         ^X^    Make the current window larger
  3290.  
  3291. handle-tab         ^I    Insert a tab or set tab stops
  3292.  
  3293. hunt-forward         A-S    Hunt for the next match of the last
  3294.                 search string
  3295.  
  3296. hunt-backward         A-R    Hunt for the last match of the last
  3297.                 search string
  3298.  
  3299. help             M-?    Read EMACS.HLP into a buffer and display it
  3300.  
  3301. i-shell          ^XC    Shell up to a new command processor
  3302.  
  3303. incremental-search     ^XS    Search for a string, incrementally
  3304.  
  3305. indent-region         M-(    Indent the current region one tab
  3306.  
  3307. insert-file         ^X^I    insert a file at the cursor in the
  3308.                 current file
  3309.  
  3310. insert-space         ^C    Insert a space to the right of the cursor
  3311.  
  3312. insert-string        (none)    Insert a string at the cursor
  3313.  
  3314. kill-paragraph         M-^W    Delete the current paragraph
  3315.  
  3316. kill-region         ^W    Delete the current marked region, moving
  3317.                 it to the kill buffer
  3318.  
  3319. kill-to-end-of-line     ^K    Delete the rest of the current line
  3320.  
  3321. label-function-key    (none)    Set the text on a function key label
  3322.                 (HP150 only)
  3323.  
  3324. list-buffers         ^X^B    List all existing buffers
  3325.  
  3326. list-screens         A-B    List all existing screens
  3327.  
  3328. macro-to-key         M-^K    Bind a key to a macro
  3329.  
  3330. meta-prefix         <ESC>    Key used to precede all META commands
  3331.  
  3332. mouse-move-down      MSa
  3333.  
  3334. mouse-move-up         MSb
  3335.  
  3336. mouse-resize-screen     MS1
  3337.  
  3338. mouse-region-down     MSe
  3339.  
  3340. mouse-region-up      MSf
  3341.  
  3342. move-window-down     ^X^N    Move all the lines in the current window down
  3343.  
  3344. move-window-up         ^X^P    Move all the lines in the current window up
  3345.  
  3346. name-buffer         M-^N    Change the name of the current buffer
  3347.  
  3348. narrow-to-region     ^X<    hides all text not in the current region
  3349.  
  3350. newline          ^M    Insert a <NL> at the cursor
  3351.  
  3352. newline-and-indent     ^J    Insert a <NL> at the cursor and indent
  3353.                 the new line the same as the preceding line
  3354.  
  3355. next-buffer         ^XX    Bring the next buffer in the list into
  3356.                 the current window
  3357.  
  3358. next-line         ^N    Move the cursor down one line
  3359.  
  3360. next-page         ^V    Move the cursor down one page
  3361.  
  3362. next-paragraph         M-N    Move cursor to the next paragraph
  3363.  
  3364. next-window         ^XO    Move cursor to the next window
  3365.  
  3366. next-word         M-F    Move cursor to the beginning of the
  3367.                 next word
  3368.  
  3369. nop            (none)    Does nothing
  3370.  
  3371. open-line         ^O    Open a line at the cursor
  3372.  
  3373. overwrite-string    (none)    Overwrite a string at the cursor
  3374.  
  3375. pipe-command         ^X@@    Execute an external command and place
  3376.                 its output in a buffer
  3377.  
  3378. pop-buffer        (none)    Display a buffer temporarily, paging
  3379.  
  3380. previous-line         ^P    Move cursor up one line
  3381.  
  3382. previous-page         ^Z    Move cursor up one page
  3383.  
  3384. previous-paragraph     M-P    Move back one paragraph
  3385.  
  3386. previous-window      ^XP    Move the cursor to the last window
  3387.  
  3388. previous-word         M-B    Move the cursor to the beginning of the
  3389.                 word to the left of the cursor
  3390.  
  3391. print            (none)    Display a string on the command line
  3392.                 (a synonim to write-message)
  3393.  
  3394. query-replace-string     M-^R    Replace all of one string with another
  3395.                 string, interactively querying the user
  3396.  
  3397. quick-exit         M-Z    Exit EMACS, writing out all changed buffers
  3398.  
  3399. quote-character      ^Q    Insert the next character literally
  3400.  
  3401. read-file         ^X^R    Read a file into the current buffer
  3402.  
  3403. redraw-display         M-^L    Redraw the display, centering the
  3404.                 current line
  3405.  
  3406. remove-mark        (none)    Remove a numbered mark
  3407.  
  3408. resize-window         ^XW    Change the number of lines in the
  3409.                 current window
  3410.  
  3411. restore-window        (none)    Move cursor to the last saved window
  3412.  
  3413. replace-string         M-R    Replace all occurrences of one string
  3414.                 with another string from the cursor
  3415.                 to the end of the buffer
  3416.  
  3417. reverse-incremental-search^XR    Search backwards, incrementally
  3418.  
  3419. run             M-^E    Execute a named procedure
  3420.  
  3421. save-file         ^X^S    Save the current buffer if it is changed
  3422.  
  3423. save-window        (none)    Remember current window (to restore later)
  3424.  
  3425. scroll-next-up         M-^Z    Scroll the next window up
  3426.  
  3427. scroll-next-down     M-^V    Scroll the next window down
  3428.  
  3429. search-forward         ^S    Search for a string
  3430.  
  3431. search-reverse         ^R    Search backwards for a string
  3432.  
  3433. select-buffer         ^XB    Select a buffer to display in the
  3434.                 current window
  3435.  
  3436. set             ^XA    Set a variable to a value
  3437.  
  3438. set-encryption-key     M-E    Set the encryption key of the current buffer
  3439.  
  3440. set-fill-column      ^XF    Set the current fill column
  3441.  
  3442. set-mark            Set the mark
  3443.  
  3444. shell-command         ^X!    Causes an external shell to execute
  3445.                 a command
  3446.  
  3447. show-files        (none)    Pop up a list of files from the
  3448.                 specified directory
  3449.  
  3450. shrink-window         ^X^Z    Make the current window smaller
  3451.  
  3452. source            (none)    Execute a file as a macro
  3453.  
  3454. split-current-window     ^X2    Split the current window in two
  3455.  
  3456. store-macro        (none)    Store the following macro lines to a
  3457.                 numbered macro
  3458.  
  3459. store-procedure     (none)    Store the following macro lines to a
  3460.                 named procedure
  3461.  
  3462. transpose-characters     ^T    Transpose the character at the cursor
  3463.                 with the character to the left
  3464.  
  3465. trim-region         ^X^T    Trim any trailing white space from a region
  3466.  
  3467. unbind-key         M-^K    Unbind a key from a function
  3468.  
  3469. undent-region         M-)    Remove a leading indent from a region
  3470.  
  3471. universal-argument     ^U    Execute the following command 4 times
  3472.  
  3473. unmark-buffer         M-~    Unmark the current buffer (so it is
  3474.                 no longer changed)
  3475.  
  3476. update-screen        (none)    Force a screen update during macro execution
  3477.  
  3478. view-file         ^X^V    Find a file,and put it in view mode
  3479.  
  3480. widen-from-region     ^X>    restores hidden text (see narrow-to-region)
  3481.  
  3482. wrap-word        (none)    Wrap the current word, this is an
  3483.                 internal function
  3484.         
  3485. write-file         ^X^W    Write the current buffer under a new
  3486.                 file name
  3487.  
  3488. write-message        (none)    Display a string on the command line
  3489.  
  3490. yank             ^Y    yank the kill buffer into the current
  3491.                 buffer at the cursor
  3492. @end(verbatim)
  3493. @appendix(MicroEMACS Bindings)
  3494.  
  3495.     Below is a complete list of the key bindings used in MicroEMACS.
  3496. This can be used as a wall chart reference for MicroEMACS commands.
  3497.  
  3498. @begin(verbatim)
  3499. @center(@b[Default Key Bindings for MicroEmacs 3.12])
  3500.  
  3501.  ^A   Move to start of line          ESC A   Apropos (list some commands)
  3502.  ^B   Move backward by characters     ESC B   Backup by words
  3503.  ^C   Insert space              ESC C   Initial capitalize word
  3504.  ^D   Forward delete              ESC D   Delete forward word
  3505.  ^E   Goto end of line              ESC E   Reset Encryption Key
  3506.  ^F   Move forward by characters      ESC F   Advance by words
  3507.  ^G   Abort out of things          ESC G   Go to a line
  3508.  ^H   Backward delete              
  3509.  ^I   Insert tab/Set tab stops
  3510.  ^J   Insert <NL>, then indent            
  3511.  ^K   Kill forward              ESC K   Bind Key to function
  3512.  ^L   Refresh the screen          ESC L   Lower case word
  3513.  ^M   Insert <NL>              ESC M   Add global mode
  3514.  ^N   Move forward by lines          ESC N   Goto End paragraph
  3515.  ^O   Open up a blank line          
  3516.  ^P   Move backward by lines          ESC P   Goto Begining of paragraph
  3517.  ^Q   Insert literal              ESC Q   Fill current paragraph
  3518.  ^R   Search backwards              ESC R   Search and replace
  3519.  ^S   Search forward              ESC S   Suspend (BSD only)
  3520.  ^T   Transpose characters               
  3521.  ^U   Repeat command four times       ESC U   Upper case word
  3522.  ^V   Move forward by pages          ESC V   Move backward by pages
  3523.  ^W   Kill region              ESC W   Copy region to kill buffer
  3524.  ^Y   Yank back from killbuffer       ESC X   Execute named command
  3525.  ^Z   Move backward by pages          ESC Z   Save all buffers and exit
  3526.  
  3527.  ESC ^C   Count words in region       ESC ~   Unmark current buffer
  3528.  ESC ^E   Execute named procedure
  3529.  ESC ^F   Goto matching fence          ESC !   Reposition window
  3530.  ESC ^H   Delete backward word          ESC <   Move to start of buffer
  3531.  ESC ^K   Unbind Key from function    ESC >   Move to end of buffer
  3532.  ESC ^L   Reposition window          ESC .   Set mark
  3533.  ESC ^M   Delete global mode          ESC space    Set mark
  3534.  ESC ^N   Rename current buffer       ESC rubout   Delete backward word
  3535.  ESC ^R   Search & replace w/query      rubout   Backward delete
  3536.  ESC ^S   Source command file
  3537.  ESC ^V   Scroll next window down
  3538.  ESC ^W   Delete Paragraph
  3539.  ESC ^X   Execute command line
  3540.  ESC ^Z   Scroll next window up
  3541.  
  3542.  ^X <    Narrow-to-region       ^X ?   Describe a key
  3543.  ^X >    Widen-from-region       ^X !   Run 1 command in a shell
  3544.  ^X =    Show the cursor position   ^X @@   Pipe shell command to buffer
  3545.  ^X ^    Enlarge display window       ^X #   Filter buffer thru shell filter
  3546.  ^X 0    Delete current window       ^X $   Execute an external program
  3547.  ^X 1    Delete other windows       ^X (   Begin macro
  3548.  ^X 2    Split current window       ^X )   End macro
  3549.                    ^X A   Set variable value
  3550.  ^X ^B     Display buffer list       ^X B   Switch a window to a buffer
  3551.  ^X ^C     Exit MicroEMACS       ^X C   Start a new command processor
  3552.  ^X ^D     Detab line           ^X D   Suspend MicroEMACS (BSD4.2 only)
  3553.  ^X ^E     Entab line           ^X E   Execute macro
  3554.  ^X ^F     Find file           ^X F   Set fill column
  3555.  ^X ^I     Insert file
  3556.                    ^X K   Delete buffer
  3557.  ^X ^L     Lower case region
  3558.  ^X ^M     Delete Mode           ^X M   Add a mode
  3559.  ^X ^N     Move window down       ^X N   Rename current filename
  3560.  ^X ^O     Delete blank lines       ^X O   Move to the next window
  3561.  ^X ^P     Move window up        ^X P   Move to the previous window
  3562.  ^X ^R     Get a file from disk       ^X R   Incremental reverse search
  3563.  ^X ^S     Save current file       ^X S   Incremental forward search
  3564.  ^X ^T     Trim line           (Incremental search
  3565.  ^X ^U     Upper case region          not always available)
  3566.  ^X ^V     View file
  3567.  ^X ^W     Write a file to disk       ^X W   resize Window
  3568.  ^X ^X     Swap "." and mark       ^X X   Use next buffer
  3569.  ^X ^Z     Shrink window           ^X Z   Enlarge display window
  3570.  
  3571. @u(Usable Modes)
  3572. WRAP     Lines going past right margin "wrap" to a new line
  3573. VIEW     Read-Only mode where no modifications are allowed
  3574. CMODE     Change behavior of some commands to work better with C
  3575. EXACT     Exact case matching on search strings
  3576. OVER     Overwrite typed characters instead of inserting them
  3577. CRYPT     Current buffer will be encrypted on write, decrypted on read
  3578. MAGIC     Use regular expression matching in searches
  3579. ASAVE     Save the file every 256 inserted characters
  3580. SPELL     Invoke MicroSPELL to check for spelling errors
  3581. REP     Similar to OVER, handles double-byte characters and tabs differently
  3582.  
  3583. WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK/GREY/GRAY/LRED/LGREEN/LYELLO/LBLUE/LMAGENTA/LCYAN    Sets foreground color
  3584. white/cyan/magenta/yellow/blue/red/green/black/grey/gray/lred/lgreen/lyello/lblue/lmagenta/lcyan    Sets background color
  3585. @end(verbatim)
  3586. @newpage
  3587. @appendix(Numeric Arguments to Commands)
  3588. @index(numeric arguments)
  3589.  
  3590.     In general, preceding a MicroEMACS command with a numeric argument
  3591. @b(n) causes the command to be executed @b(n) times. However, there
  3592. are a great many commands for which this has no effect, simply because
  3593. it would make no sense for the command to be executed more than once. 
  3594. There are also commands that take advantage of the numeric arguments to
  3595. alter their behavior subtly or unsubtly. The following is a list of
  3596. these commands. Commands that are not affected at all by numeric
  3597. arguments are listed afterwards.
  3598.  
  3599. @begin(description)
  3600. @index(backward-character)
  3601. backward-character@\A negative argument invokes @i(forward-character).
  3602.  
  3603. @index(change-screen-size)
  3604. change-screen-size@\With no arguments, the number of rows defaults to
  3605. the largest. Otherwise, set the screen size to @b(n).
  3606.  
  3607. @index(change-screen-width)
  3608. change-screen-width@\With no arguments, the number of columns defaults to
  3609. the largest. Otherwise, set the screen width to @b(n).
  3610.  
  3611. @index(clear-and-redraw)
  3612. clear-and-redraw@\With an argument, centers the window around the
  3613. current cursor position.
  3614.  
  3615. @index(delete-next-character)
  3616. delete-next-character@\A negative argument invokes
  3617. @i(delete-previous-character).
  3618.  
  3619. @index(delete-next-word)
  3620. delete-next-word@\With an argument of 0, will not delete the whitespace
  3621. trailing the deleted word. A negative argument will cause nothing to
  3622. happen.
  3623.  
  3624. @index(delete-previous-character)
  3625. delete-previous-character@\A negative argument invokes
  3626. @i(delete-next-character).
  3627.  
  3628. @index(delete-previous-word)
  3629. delete-previous-word@\An negative or zero argument will cause nothing to
  3630. happen.
  3631.  
  3632. @index(detab-region)
  3633. detab-region@\Without an argument, @i(detab-region) changes hard tabs to
  3634. spaces in the lines between the mark and the cursor. With an argument
  3635. @b(n), the commands detab @b(n) lines - forward if @b(n) is positive,
  3636. backwards if not.
  3637.  
  3638. @index(end-of-word)
  3639. end-of-word@\A negative argument invokes @i(next-word).
  3640.  
  3641. @index(entab-region)
  3642. entab-region@\Without an argument, @i(entab-region) changes spaces to
  3643. hard tabs in the lines between the mark and the cursor. With an
  3644. argument @b(n), the commands entab @b(n) lines - forward if @b(n) is
  3645. positive, backwards if not.
  3646.  
  3647. @index(exchange-point-and-mark)
  3648. exchange-point-and-mark@\Swap the current cursor position and mark
  3649. number @b(n). Without an argument, @b(n) defaults to 0.
  3650.  
  3651. @index(exit-emacs)
  3652. exit-emacs@\Providing a numeric argument @b(n) causes two things to
  3653. happen. First, no checking for modified buffers will occur. Second,
  3654. MicroEMACS exits with a status of @b(n).
  3655.  
  3656. @index(forward-character)
  3657. forward-character@\A negative argument invokes @i(backward-character).
  3658.  
  3659. @index(goto-line)
  3660. goto-line@\An argument @b(n) will be taken as the line number to go to. 
  3661. Without an argument, you will be asked for a line number. In either
  3662. case, the line number must be 1 or greater.
  3663.  
  3664. @index(goto-mark)
  3665. goto-mark@\Go to mark number @b(n). Without an argument, @b(n)
  3666. defaults to 0.
  3667.  
  3668. @index(grow-window)
  3669. grow-window@\A negative argument invokes @i(shrink-window). An argument
  3670. of 0 causes no action.
  3671.  
  3672. @index(handle-tab)
  3673. handle-tab@\Without an argument, @i(handle-tab) deals with the tab
  3674. character, whether it should be a single "hard" tab, or expanded as
  3675. spaces. With an argument @b(n), $softtab is set to @b(n).
  3676.  
  3677. @index(hunt-backward)
  3678. hunt-backward@\The command will hunt @b(n) times. The command will
  3679. report failure if it cannot find its pattern the @b(nth) time, even if
  3680. has found an occurrence of the pattern before number @b(n). A negative
  3681. argument invokes @i(hunt-forward).
  3682.  
  3683. @index(hunt-forward)
  3684. hunt-forward@\The command will hunt @b(n) times. The command will
  3685. report failure if it cannot find its pattern the @b(nth) time, even if
  3686. has found an occurrence of the pattern before number @b(n). A negative
  3687. argument invokes @i(hunt-backward).
  3688.  
  3689. @index(kill-to-end-of-line)
  3690. kill-to-end-of-line@\With no argument @b(n), the command deletes all
  3691. characters to the end of the line. If it is already at the end of the
  3692. line, it will delete the newline. With a positive @b(n) as an
  3693. argument, the command will delete @b(n) complete lines, newline
  3694. character and all, starting from the cursor. With @b(n) equal to zero,
  3695. the command deletes all text from the cursor to the beginning of the
  3696. line, but will not delete past the newline character. A negative @b(n)
  3697. is illegal.
  3698.  
  3699. @index(list-buffers)
  3700. list-buffers@\With a numeric argument, INVISIBLE buffers are also
  3701. listed.
  3702.  
  3703. @index(move-window-down)
  3704. move-window-down@\With a negative argument, invokes @i(move-window-up).
  3705.  
  3706. @index(move-window-up)
  3707. move-window-up@\With a negative argument, invokes @i(move-window-down).
  3708.  
  3709. @index(next-buffer)
  3710. next-buffer@\With an argument @b(n), the @b(nth) buffer after the
  3711. current one is selected, and read in if necessary. Any buffers in
  3712. between the current buffer and the target buffer that have not yet been
  3713. read in are read.
  3714.  
  3715. @index(next-line)
  3716. next-line@\A negative argument invokes @i(previous-line).
  3717.  
  3718. @index(next-page)
  3719. next-page@\Without an argument, the window is scrolled forward by a
  3720. full page. With an argument @b(n), the window is scrolled forwards by
  3721. @b(n) lines. The cursor is placed on the upper left hand corner.
  3722. Negative arguments invoke @i(previous-page).
  3723.  
  3724. @index(next-paragraph)
  3725. next-paragraph@\A negative argument invokes @i(previous-paragraph).
  3726.  
  3727. @index(next-window)
  3728. next-window@\With a positive argument @b(n), the @b(nth) window from
  3729. the top becomes the working window. With a negative argument, the
  3730. @b(nth) window from the bottom becomes the working window.
  3731.  
  3732. @index(next-word)
  3733. next-word@\A negative argument invokes @i(previous-word).
  3734.  
  3735. @index(pop-buffer)
  3736. pop-buffer@\Without an argument, the buffer is simply displayed in its
  3737. pop-up screen. With an argument, the buffer is not only displayed, but
  3738. also given the attribute INVISIBLE.
  3739.  
  3740. @index(previous-line)
  3741. previous-line@\A negative argument invokes @i(next-line).
  3742.  
  3743. @index(previous-page)
  3744. previous-page@\Without an argument, the window is scrolled backward by a
  3745. full page. With an argument @b(n), the window is scrolled backwards by
  3746. @b(n) lines. The cursor is placed on the upper left hand corner.
  3747. Negative arguments invoke @i(next-page).
  3748.  
  3749. @index(previous-paragraph)
  3750. previous-paragraph@\A negative argument invokes @i(next-paragraph).
  3751.  
  3752. @index(previous-window)
  3753. previous-window@\With a positive argument @b(n), the @b(nth) window from
  3754. the bottom becomes the working window. With a negative argument, the
  3755. @b(nth) window from the top becomes the working window.
  3756.  
  3757. @index(previous-word)
  3758. previous-word@\A negative argument invokes @i(next-word).
  3759.  
  3760. @index(query-replace-string)
  3761. query-replace-string@\With a numeric argument, @b(n) occurrences of the
  3762. search string may be replaced, depending upon the user's response. The
  3763. count is based on the number of occurrences found, not the number of
  3764. positive responses from the user.
  3765.  
  3766. @index(quick-exit)
  3767. quick-exit@\Saves all modifed buffers, and exits with a status of @b(n).
  3768.  
  3769. @index(redraw-display)
  3770. redraw-display@\With no argument, or when @b(n) is 0, the window
  3771. is adjusted so that the cursor is in the center. When @b(n) is
  3772. positive, the window is adjusted so that the cursor is on the @b(nth)
  3773. line of the screen. When @b(n) is negative, the window is adjusted so
  3774. that the cursor is on the last line of the window, regardless of the
  3775. magnitude of @b(n).
  3776.  
  3777. @index(remove-mark)
  3778. remove-mark@\Remove mark number @b(n). Without an argument, @b(n)
  3779. defaults to 0. 
  3780.  
  3781. @index(replace-string)
  3782. replace-string@\Will replace @b(n) occurrences of the search string with
  3783. the replacement string. Otherwise, with no argument, all occurrences
  3784. from the cursor position to the end of file are replaced.
  3785.  
  3786. @index(resize-window)
  3787. resize-window@\Requires an argument which must be positive.
  3788.  
  3789. @index(scroll-next-down)
  3790. scroll-next-down@\A negative argument invokes @i(scroll-next-up).
  3791.  
  3792. @index(scroll-next-up)
  3793. scroll-next-up@\A negative argument invokes @i(scroll-next-down).
  3794.  
  3795. @index(search-forward)
  3796. search-forward@\The command will search @b(n) times. The command will
  3797. report failure if it cannot find its pattern the @b(nth) time, even if it
  3798. has found an occurrence of the pattern before number @b(n). A negative
  3799. argument invokes @i(search-reverse).
  3800.  
  3801. @index(search-reverse)
  3802. search-reverse@\The command will search @b(n) times. The command will
  3803. report failure if it cannot find its pattern the @b(nth) time, even if
  3804. has found an occurrence of the pattern before number @b(n). A negative
  3805. argument invokes @i(search-forward).
  3806.  
  3807. @index(select-buffer)
  3808. select-buffer@\Without an argument, the buffer is simply displayed in
  3809. the window. With an argument, the buffer is not only displayed, but
  3810. also given the attribute INVISIBLE.
  3811.  
  3812. @index(set)
  3813. set@\If using the @i(set) command interactively, preceding the command with
  3814. a numeric argument then makes it unecessary for the command to ask for
  3815. the variable's value (it will still ask for the variable's name). If
  3816. used in a command line, then the command
  3817.  
  3818. @begin(verbatim)
  3819.     set <variable name> <number>
  3820. @end(verbatim)
  3821.  
  3822. is identical to
  3823.  
  3824. @begin(verbatim)
  3825.     <number> set <variable name>
  3826. @end(verbatim)
  3827.  
  3828. @index(set-fill-column)
  3829. set-fill-column@\With an argument, the fill column is set to @b(n). The
  3830. default argument is 1.
  3831.  
  3832. @index(set-mark)
  3833. set-mark@\Set mark number @b(n). Without an argument, @b(n) defaults to
  3834. 0. 
  3835.  
  3836. @index(shrink-window)
  3837. shrink-window@\A negative argument invokes @i(grow-window). An argument
  3838. of 0 causes no action.
  3839.  
  3840. @index(split-current-window)
  3841. split-current-window@\With @b(n) = 1, the new upper window becomes the
  3842. current window. Any other numeric argument makes the new lower
  3843. window the current window. With no argument, the current window becomes
  3844. the new upper or lower window depending upon whether the cursor was in
  3845. the upper or lower half of the old window.
  3846.  
  3847. @index(store-macro)
  3848. store-macro@\Since macroes are numbered, a numeric argument must be
  3849. provided. These numbered macroes are being phased out in preference for
  3850. named macroes.
  3851.  
  3852. @index(store-procedure)
  3853. store-procedure@\If the command is provided a numeric argument, it will
  3854. assume that @i(store-macro) is actually being called.
  3855.  
  3856. @index(trim-region)
  3857. trim-region@\Without an argument, @i(trim-region) removes spaces and
  3858. tabs from the end of the lines between the mark and the cursor. With an
  3859. argument @b(n), the commands trim @b(n) lines - forward if @b(n) is
  3860. positive, backwards if not.
  3861. @end(description)
  3862. @appendixsection(Commands unaffected by numeric arguments.)
  3863. @begin(col3)
  3864. abort-command
  3865. add-global-mode
  3866. add-mode
  3867. append-file
  3868. apropos
  3869. back-from-tag-word
  3870. begin-macro
  3871. beginning-of-file
  3872. beginning-of-line
  3873. bind-to-key
  3874. buffer-position
  3875. case-region-lower
  3876. case-region-upper
  3877. change-file-name
  3878. clear-message-line
  3879. copy-region
  3880. count-words
  3881. cycle-screens
  3882. delete-blank-lines
  3883. delete-buffer
  3884. delete-global-mode
  3885. delete-mode
  3886. delete-other-windows
  3887. delete-screen
  3888. delete-window
  3889. describe-bindings
  3890. describe-functions
  3891. describe-key
  3892. describe-variables
  3893. display
  3894. end-macro
  3895. end-of-file
  3896. end-of-line
  3897. execute-command-line
  3898. execute-program
  3899. fill-paragraph
  3900. filter-buffer
  3901. find-file
  3902. find-screen
  3903. goto-matching-fence
  3904. help
  3905. i-shell
  3906. incremental-search
  3907. insert-file
  3908. kill-region
  3909. macro-to-key
  3910. mouse-move-down
  3911. mouse-move-up
  3912. mouse-region-down
  3913. mouse-region-up
  3914. mouse-resize-screen
  3915. name-buffer
  3916. narrow-to-region
  3917. nop
  3918. pipe-command
  3919. print
  3920. re-tag-word
  3921. read-file
  3922. restore-window
  3923. reverse-incremental-search
  3924. save-file
  3925. save-window
  3926. set-encryption-key
  3927. shell-command
  3928. suspend-emacs
  3929. tag-word
  3930. transpose-characters
  3931. unbind-key
  3932. unmark-buffer
  3933. update-screen
  3934. view-file
  3935. widen-from-region
  3936. wrap-word
  3937. write-file
  3938. write-message
  3939. @end(col3)
  3940. @newpage
  3941. @appendix(Supported machines)
  3942.  
  3943.     The following table lists all the hardware/compilers for which I
  3944. currently support MicroEMACS. This is not exclusive of all machines
  3945. which MicroEMACS will run on, but I have either run it myself, or had a
  3946. first hand report of it running.
  3947.  
  3948. @begin(verbatim)
  3949. @u(Hardware    OS        Compiler    Comments)
  3950. VAX 780     UNIX V5     native
  3951.         UNIX V7     native
  3952.         BSD 4.2     native        job control supported
  3953.         VMS        native        SMG & ANSI support
  3954.  
  3955. SUN        SUNOS 3 & 4    native
  3956.                 gcc
  3957.  
  3958. NCR Tower    UNIX V5     native
  3959.  
  3960. IBM-RT PC    BSD 4.3     native
  3961.         AIX        native
  3962.  
  3963. HP9000        UNIX V5     native
  3964.  
  3965. Fortune 32:16    UNIX V7     native
  3966.  
  3967. IBM-PC        MSDOS        LATTICE 3    Large CODE/Large DATA
  3968.          2.0 & 3.2    AZTEC 3.4e    Large CODE/Large DATA
  3969.                 TURBO C 2.0    LARGE memory model
  3970.                 MSC 6.0
  3971.                 *MWC 86
  3972.         SCO XENIX    native
  3973.  
  3974. HP150        MSDOS        Lattice 2.15    Function key labels
  3975.                 Turbo C 2.0        for the touch screen
  3976.  
  3977. HP110        MSDOS        Lattice 2.15
  3978.                 Aztec 3.4e
  3979.                 Turbo C 2.0
  3980.  
  3981. *Data General 10
  3982.         MSDOS        Lattice 2.1  Texas Instruments Professional
  3983.         MSDOS        Lattice 2.15
  3984.  
  3985. Amiga        Intuition    Lattice 3.03
  3986.                 Aztec 3.6
  3987.  
  3988. ST520        TOS        Mark Williams C Spawns under MSH
  3989.                 Lattice 3.1    (no shell commands)
  3990.  
  3991. Fujitsu FMR    MSDOS        MSC 6.0
  3992.    series
  3993.  
  3994. NEC 9800    MSDOS        Turbo 2.0    Function key support
  3995.    series            MSC 6.0
  3996.  
  3997. HP3000 series    MPE        native
  3998.  
  3999. @u[Systems to be supported (IE some code is already written:)]
  4000. Macintosh    System 7    Lightspeed C
  4001.  
  4002. *means that I do not own or have access to the listed compiler and/or
  4003.  machine and must rely upon others to help support it. 
  4004. @end(verbatim)
  4005. @newpage
  4006. @appendix(Function Keys)
  4007.  
  4008.     All environments now support a set of machine independant
  4009. bindings for function keys. Below is a list of these bindings (not all
  4010. of these are supported on all systems).
  4011.  
  4012. @begin(verbatim)
  4013.             Function keys in MicroEmacs
  4014.  
  4015.     function    Function    ^function    Alt-function
  4016.  f1)      FN1         S-FN1          FN^1          A-FN1
  4017.  f2)      FN2         S-FN2          FN^2          A-FN2
  4018.  f3)      FN3         S-FN3          FN^3          A-FN3
  4019.  f4)      FN4         S-FN4          FN^4          A-FN4
  4020.  f5)      FN5         S-FN5          FN^5          A-FN5
  4021.  f6)      FN6         S-FN6          FN^6          A-FN6
  4022.  f7)      FN7         S-FN7          FN^7          A-FN7
  4023.  f8)      FN8         S-FN8          FN^8          A-FN8
  4024.  f9)      FN9         S-FN9          FN^9          A-FN9
  4025. f10)      FN0         S-FN0          FN^0          A-FN0
  4026.  
  4027. home)      FN<                  FN^<
  4028. CsUp)      FNP                  FN^P
  4029. PgUp)      FNZ                  FN^Z
  4030. CsLf)      FNB                  FN^B
  4031.  5  )
  4032. CsRt)      FNF                  FN^F
  4033.  End)      FN>                  FN^>
  4034. CsDn)      FNN                  FN^N
  4035. PgDn)      FNV                  FN^V
  4036.  Ins)      FNC                  FN^C
  4037.  Del)      FND                  FN^D
  4038. @end(verbatim)
  4039. @newpage
  4040. @appendix(Machine Dependent Notes)
  4041.  
  4042.     This appendix lists some notes specific to individual
  4043. implementations of MicroEMACS. Every attempt has been made to allow
  4044. EMACS to be identical on all machines, but we have also tried to take
  4045. advantage of function keys, cursor keys, mice, and special screen modes
  4046. where possible.
  4047.  
  4048. @appendixsection(IBM-PC/XT/AT and its clones)
  4049.  
  4050.     The IBM-PC family of computers is supported with a variety of
  4051. different display adapters. EMACS will attempt to discover what adapter
  4052. is connected and use the proper driver for it. Below is a list of the
  4053. currently supported video adapters:
  4054.  
  4055. @begin(verbatim)
  4056. @u(Adapter            $sres        Original mode used)
  4057. Monochrome Graphics Adapter    MONO        MONO
  4058. Color Graphics Adapter        CGA        CGA
  4059.                 CGA40        CGA40
  4060. Enhanced Graphics Adapter    EGA        CGA
  4061. Video Graphics Adapter        VGA        CGA
  4062.                 VGA12
  4063. @end(verbatim)
  4064.  
  4065.     If a driver for a Microsoft compatable mouse is installed on the
  4066. system, EMACS will use the mouse in text mode and allow the user all the
  4067. standard mouse functions. The mouse cursor will appear to be a block of
  4068. color in the color opposite of it's background.
  4069.  
  4070.     EMACS also takes advantage of various function keys and the keys
  4071. on the keypad on an IBM-PC. The function keys are initially not bound
  4072. to any particular functions (except by the emacs.rc startup file), but
  4073. the keypad keys do default to the following:
  4074.  
  4075. @begin(verbatim)
  4076. @u(Keypad key    Function)
  4077. Home        beginning-of-file
  4078. CSRS UP     previous-line
  4079. Pg Up        previous-page
  4080. CSRS LEFT    backward-character
  4081. CSRS RIGHT    forward-character
  4082. End        end-of-file
  4083. CSRS DOWN    next-line
  4084. Pg Dn        Next-page
  4085. @end(verbatim)
  4086.  
  4087.     All these special keys are indicated in EMACS macroes by use of
  4088. the @b(FN) prefix. Below is a list of many of the keys and the codes
  4089. used to specify them. Also the codes may be gotten by using the
  4090. describe-key (^X ?) command on the suspect key.
  4091.  
  4092. @flushleft(@b[Compiling under TURBO C])
  4093.  
  4094.     To compile MicroEMACS under TURBO C, set the TURBO integrated
  4095. environment with the following options:
  4096.  
  4097.     Memory model        LARGE
  4098.     Floating point        NONE
  4099.     Default char type    UNSIGNED
  4100.     Data alignment        BYTE
  4101.     Merge duplicate strings ON
  4102.     Standard stack frame    off
  4103.     Test stack overflow    off
  4104.  
  4105.     Optimize for            SIZE
  4106.     Use register optimization    ON
  4107.     Register optimization        ON
  4108.     Jump optimization        ON
  4109.  
  4110.     Initialize segments    OFF
  4111.     Stack warnings        OFF
  4112.  
  4113.     Names: Code names
  4114.         Segment name    *
  4115. @newpage
  4116. @appendixsection(HP 150)
  4117.  
  4118.     This machine from Hewlett Packard is very unusual for an MSDOS
  4119. machine. It has a touch screen and is very function key oriented. An
  4120. additional command, @i(label-function-key)@index(label-function-key)
  4121. allows you to place labels on the on screen function key labels. A
  4122. numeric argument indicates which function key to label (one through
  4123. eight) and then the program prompts for a 16 character label, which will
  4124. be used as two lines of eight characters. To label function key three
  4125. with "save file" from a macro, you would use:
  4126.  
  4127. @verbatim(3 label-function-key "save    file")
  4128.  
  4129.     Notice the 4 spaces after "save". This forces "file" to begin on
  4130. the second line of the label.
  4131. @newpage
  4132. @appendixsection(Atari 520/1040ST)
  4133.  
  4134.     The ATARI ST family of computers have a dual personality. They
  4135. may use either a monochrome or a color screen. EMACS supports two
  4136. screen resolutions on each monitor. 
  4137.  
  4138. @center(@b[NOTE])
  4139.  
  4140. @quotation(When you set MicroEMACS up on your system, please remember to
  4141. install it on the desktop as a GEM application. If you have EMACS set
  4142. as a TOS application, the mouse will not function properly, and EMACS
  4143. will alert you to this problem by beeping the bell.)
  4144.  
  4145. @begin(verbatim)
  4146. @u(Monitor $sres size #color $palette format)
  4147. Color    LOW    40x25    16    000111222333444555666777
  4148.     MEDIUM    80x25    4    000111222333
  4149. Mono    HIGH    80x25    2    000
  4150.     DENSE    80x50    2    000
  4151. @end(verbatim)
  4152.  
  4153.     The $palette environment variable can be used to change what
  4154. color is associated with each color name. With a color monitor, each
  4155. group of three digits indicates an octal number specifying the RED,
  4156. GREEN and BLUE levels of that color. Each color digit can vary from 0
  4157. to 7. For example, the initial setting of $palette in LOW resolution is:
  4158.  
  4159. @begin(verbatim)
  4160.     000700070770007707077777
  4161.  
  4162.     which broken up is:
  4163.  
  4164.     000 700 070 770 007 707 077 777
  4165.  
  4166.     which means:
  4167.  
  4168.     000    Black
  4169.     700    Red
  4170.     070    Green
  4171.     770    Yellow
  4172.     007    Blue
  4173.     707    Magenta
  4174.     077    Cyan
  4175.     777    White
  4176. @end(verbatim)
  4177.  
  4178.     Also the mouse buttons are bound to mouse functions as
  4179. described in the chapter about mice. The cursor keys and the function
  4180. keys are bound similarly to IBM-PC.
  4181.  
  4182.     Files generated by EMACS on the ATARI ST have a single return
  4183. character at the end of each line, unlike the desktop files which want
  4184. to have two returns. This makes it display files strangely from GEM's
  4185. [SHOW] option, but makes the files port to other computers much nicer.
  4186. When compiling MicroEMACS, the ADDCR symbol in @b(estruct.h) will cause
  4187. emacs to generate line ending sequences compatible with GEM.
  4188.  
  4189.     Currently, when operating under the Mark Williams MSH program,
  4190. EMACS can shell out and perform external commands. This capability will
  4191. be added later for the Beckmeyer shell and under GEMDOS.
  4192. @newpage
  4193. @appendixsection(Amiga 1000)
  4194.  
  4195.     The Commodore AMIGA 1000 version of MicroEMACS does fully
  4196. support the mouse, window resizing and the close gadget. It runs in
  4197. medium resolution, using the colors defined for the workbench. 
  4198.  
  4199. @center(Note about Compiling MicroEMACS)
  4200.  
  4201. @begin(quotation)
  4202.     If you are compiling the sources on the AMIGA to produce an
  4203. executable image, and you are using the Lattice compiler, be sure to
  4204. give the CLI command 'STACK 40000' before compiling to make sure the
  4205. compiler has sufficient stack space to successfully complete
  4206. compilation.
  4207. @end(quotation)
  4208. @newpage
  4209. @appendixsection(UNIX V5, V7, and BSD4.[23])
  4210.  
  4211.     MicroEMACS under UNIX utilizes the @b(TERMCAP) @index(termcap)
  4212. library to provide machine independent screen functions. Make sure that
  4213. termcap is available and properly set on your account before attempting
  4214. to use MicroEMACS. 
  4215.  
  4216.     Under systems which support job control, you can use the
  4217. @b(^XD) @i(suspend-emacs) @index(suspend-emacs) command to place EMACS
  4218. into the background. This carries a much smaller overhead than bringing
  4219. up a new shell under EMACS. EMACS will properly redraw the screen when
  4220. you bring it back to the foreground.
  4221.  
  4222.     If the symbol VT100 has been set to 1 in the @i(estruct.h)
  4223. options file, EMACS will recognize the key sequence <ESC>[ as the lead
  4224. in sequence for the FN function key prefix.
  4225.  
  4226.     With the addition of some very machine/operating system specific
  4227. code, EMACS can prevent two or more people from modifying the same file
  4228. at the same time. @index(file locking) The upper level of a set of
  4229. functions to provide file locking exist in the source file @b(LOCK.C). 
  4230. It requires two machine specific functions written and linked into EMACS
  4231. for it to operate properly. 
  4232.  
  4233. @begin(verbatim)
  4234.     char *dolock(fname)
  4235.  
  4236.     char *fname;
  4237.  
  4238.     dolock() locks a file, preventing others from modifying it. If
  4239.     it succeeds, it returns NULL, otherwise it returns a pointer to
  4240.     a string in the form "LOCK ERROR: explanation".
  4241.  
  4242.     char *undolock(fname)
  4243.  
  4244.     char *fname;
  4245.  
  4246.     undolock() unlocks a file, allowing others to modifying it. If
  4247.     it succeeds, it returns NULL, otherwise it returns a pointer to
  4248.     a string in the form "LOCK ERROR: explanation".
  4249. @end(verbatim)
  4250. @newpage
  4251. @appendixsection(DEC VMS operating system)
  4252.  
  4253. @flushleft(@b[TERMINALS])
  4254.  
  4255.     Depending upon the options set in ESTRUCT.H, MicroEMACS uses
  4256. either the capabilities of VMS SMG, working with any terminal that is
  4257. defined in SMGTERMS.TXT or TERMTABLE.TXT (see your SMG manual for more
  4258. information), or the ANSI escape sequences. Full keyboard support,
  4259. including function keys, is provided for VT100 and VT200 series
  4260. compatible terminals. Mouse support is provided under the ANSI version
  4261. only at this time. Mouse support is provided for the VSII workstation's
  4262. VT220 terminal emulator, and other terminal emulators that use the same
  4263. escape sequences for mouse control. (There is some partial support for
  4264. the BBN BitGraph mouse sequences in the sources, but this is not yet
  4265. complete). Terminals may have up to 100 lines and 160 columns. 
  4266.  
  4267.     The maximum terminal size is 256 columns and 72 rows. If you
  4268. run MicroEMACS on a terminal that is larger than this, MicroEMACS will
  4269. reduce it to these limits while you are editing.
  4270.  
  4271. @flushleft(@b[Flow control])
  4272.     Some terminals will require the use of XON/XOFF flow control
  4273. when used with MicroEMACS. When XON/XOFF flow control is used, you
  4274. will not be able to use functions bound to ^S or ^Q, and should use
  4275. bind-to-key to put these functions on other keys. MicroEMACS does not
  4276. change the flow control characteristics of your terminal line while it
  4277. is running. If your terminal requires flow control, you should:
  4278.  
  4279.     $ SET TERM/HOSTSYNC/TTSYNC
  4280.  
  4281.     before entering MicroEMACS. If you are on a VSII emulated
  4282. workstation terminal, are using the SSU multi-session protocol (VT330
  4283. and VT340 with SSU enabled), or are certain that your terminal does not
  4284. require XON/XOFF flow control, you should
  4285.  
  4286.     $ SET TERM /HOSTSYNC/NOTTSYNC
  4287.  
  4288.     This will allow you to use ^S and ^Q for MicroEMACS commands.
  4289. Note that if you are using a VSII with VWS V3.2 or later, you must
  4290. leave the /HOSTSYNC enabled in order for the cross/session cut and
  4291. paste capability to work properly.
  4292.  
  4293.  
  4294. @flushleft(@b[KEYBOARD])
  4295.  
  4296.     The VMS version understands the LK201 functions of VT200
  4297. series, vt300 series, and compatible terminals and terminal emulators,
  4298. and allows you to bind to them as function keys. In addition, the
  4299. VT100 numeric keypad, in application mode, is available as function
  4300. keys. MicroEMACS will only put the keypad into application mode for
  4301. you if the KEYPAD option is set in ESTRUCT.H. In this situation,
  4302. MicroEmacs will detect your kepad's state, and restore it to that state
  4303. upon exiting. If MicroEMACS has not been compiled with this option,
  4304. you may still put the keypad into application mode by issuing the
  4305. command "SET TERM /APPLICATION" before entering MicroEMACS. 
  4306.  
  4307. @begin(verbatim)
  4308. @u(VT200 keys)
  4309.  
  4310. Note that F1 through F5 are local function keys on DEC terminals.
  4311.  
  4312. F6         = FN6    FIND = FNS
  4313. FN7        = FN7    INSERT = FNC
  4314. F8         = FN8    REMOVE = FND
  4315. F9         = FN9    SELECT = FN@@
  4316. F10        = FN0    PREV = FNZ
  4317. F11        = S-FN1    NEXT = FNV
  4318. F12        = S-FN2    Arrow Up = FNP
  4319. F13        = S-FN3    Arrow Down = FNN
  4320. F14        = S-FN4    Arrow Right = FNF
  4321. HELP (F15) = S-FN5    Arrow Left = FNB
  4322. DO (F16)   = S-FN6
  4323. F17        = S-FN7
  4324. F18        = S-FN8
  4325. F19        = S-FN9
  4326. F20        = S-FN0
  4327.  
  4328. @u(VT100 and VT200 numeric keypad in application mode)
  4329.  
  4330. PF1 = FN^1    PF2 = FN^2    PF3 = FN^3    PF4   = FN^4
  4331. 7   = A-7    8   = A-8    9   = A-9    -     = A--
  4332. 4   = A-4    5   = A-5    6   = A-6    ,     = A-,
  4333. 1   = A-1    2   = A-2    3   = A-3    ENTER = A-E
  4334. 0   = A-0    .   = A-.
  4335. @end(verbatim)
  4336.  
  4337. @center(@b[WARNING])
  4338.  
  4339. @begin(quotation)
  4340.     The VMS version contains code for interpreting function keys
  4341. that are sent as Ansi sequences that begin with the ESC character. 
  4342. Because of this, MicroEMACS cannot process an incoming ESC until it
  4343. knows what character follows it. This can cause problems with
  4344. terminating search and replace strings. If you use ESC as the
  4345. meta-prefix character (which is the default) you must type one
  4346. additional keystroke following ESC before emacs will recognize that you
  4347. have edited the search command prompt, and are continuing. (The
  4348. additional character is processed normally be MicroEMACS, it is NOT
  4349. discarded.)
  4350.  
  4351.     MicroEMACS must wait long enough for the network delay
  4352. that might be involved between seeing the ESC and seeing the
  4353. characters that follow it. If holding down one of the arrow keys causes
  4354. characters to drop into your file, then you may want to alter the delay
  4355. yourself. The logical variable MICROEMACS$SHORTWAIT may be set to vary
  4356. that delay. The default delay is 400ms (4 tenths of a second). The
  4357. equivalent value in MICROEMACS$SHORTWAIT is 4000000.
  4358. @end(quotation)
  4359.  
  4360. @flushleft(@b[Special case for BBN BItGraph])
  4361.  
  4362.     If you are using the BBN BitGraph, execute the following commands
  4363. before entering MicroEMACS, and you will get mouse support:
  4364.  
  4365. @begin(verbatim)
  4366.     $ esc[0,8] = 27
  4367.     $ microemacs$mouse_enable == esc+":5;6;L"+esc+":0;63;;;;;;;;;9;16;c"
  4368.     $ microemacs$mouse_disable == esc+":5;1;L"+esc+":0;0c"
  4369.     $ exit
  4370. @end(verbatim)
  4371.  
  4372.     Do NOT do this for any other terminals.
  4373.  
  4374. @flushleft(@b[Search List for EMACS.RC])
  4375.  
  4376.     VMS MicroEMACS will first search logical name MICROEMACS$LIB:,
  4377. then SYS$LOGIN:, then the current directory, and finally
  4378. "sys$sysdevice:[vmstools]" when looking for startup files or help files.
  4379.  
  4380.     Please use MICROEMACS$LIB:, and allow the secondary search of
  4381. [vmstools] to become archaic. If desired, MICROEMACS$LIB may be
  4382. defined to be a VMS search list that first searches a user directory,
  4383. and then a system directory. 
  4384.  
  4385.     Generally, you should create a private directory where you keep
  4386. all your .CMD files, and in your LOGIN.COM $DEFINE a logical name to
  4387. point to this area.
  4388.  
  4389.     In addition to whatever commands you have in your EMACS.RC file,
  4390. one command you should certainly include is "set $ssave FALSE". The
  4391. "safe save" mechanism, which writes a buffer to a temporary file,
  4392. deletes the old version of a file, and then moves the temporary file to
  4393. its permanent name, works wonderfully on most systems, but makes no
  4394. sense on VMS, which maintains older versions of a file.
  4395.  
  4396. @flushleft(@b[Using MicroEMACS as a subprocess])
  4397.     MicroEmacs can now be kept in a subprocess. You can arrange to
  4398. start emacs only once in a job, and to re-attach to it each time you
  4399. want to use it. This is optional. To use this feature, install
  4400. MicroEMACS in the following way:
  4401.  
  4402. @begin(verbatim)
  4403. 1. MicroEMACS contains two images. ME.EXE is a small program for
  4404.     starting and stopping the Emacs subprocess. The source for ME.
  4405.     is in ME.C, and should not be linked into MESHR.EXE. MESHR.EXE
  4406.     is the actual MicroEMACS image. The name "MESHR" is required for
  4407.     MAIL/NOTES support, see next section for details.
  4408.  
  4409. 2. Make sure that the SYS$SHARE search list includes MESHR.EXE. If you
  4410.    don't have the privilages to move MESHR.EXE into SYS$SHARE, you
  4411.    can $ DEFINE the MESHR logical name to be the full name and location of
  4412.    the MESHR.EXE program. For example, you could store all of these
  4413.    programs in the MICROEMACS$LIB: search list, and say:
  4414.  
  4415.         $ DEFINE MESHR microemacs$lib:meshr.exe
  4416.  
  4417. 3. Put ME.EXE in MICROEMACS$LIB and the following line in your LOGIN.COM:
  4418.  
  4419.         $ me :== $microemacs$lib:me
  4420.  
  4421. 4. Put a line in your EMACS.RC that will
  4422.  
  4423.         bind-to-key suspend-emacs ^C  ; use your usual exit-emacs key
  4424. @end(verbatim)
  4425.  
  4426.     Now, use the "$ ME" command to invoke microemacs. Subseqeuent
  4427. invocations in the same job will re-use the existing subprocess. You
  4428. can use the full capabilty of the microemacs command line in the first
  4429. and in all subsequent invocations of ME.
  4430.  
  4431.     WARNING:
  4432.  
  4433.     MicroEMACS will ALWAYS read in new copies of any files you
  4434. specify on the command line, even if you are already editing it. If
  4435. you edit a file a second time with the same MicroEMACS, you will get a
  4436. NEW buffer with ANOTHER copy of the file. The old buffer is still
  4437. there also. It is easy, in this situation, to accidently edit in a
  4438. WRONG BUFFER, and if you write out an obsolete buffer, you will lose
  4439. earlier edits!
  4440.  
  4441.     This is considered a bug and may be fixed in a later version of
  4442. MicroEMACS. To avoid this situation, do not specify a file on the
  4443. command line if MicroEMACS already has that file in a buffer. Use the
  4444. "find-file" MicroEMACS command instead.
  4445.  
  4446.  
  4447.     @b(Using MICROEMACS with MAIL and NOTES:)
  4448.  
  4449.     With VMS V5 and later versions, the MAIL interface to
  4450. Microemacs is much simplified. With VMS V5, the MESHR.EXE image does
  4451. NOT have to be installed as a known image to be used as a callable
  4452. editor from MAIL. Therefore, to use MicroEMACS as your VMS MAIL
  4453. editor, simply add the following lines to your LOGIN.COM:
  4454.  
  4455. @begin(verbatim)
  4456.         $ DEFINE MAIL$EDIT CALLABLE_ME
  4457.         $ MAIL :== MAIL/EDIT
  4458. @end(verbatim)
  4459.  
  4460.     and make sure that the SYS$SHARE search list includes
  4461. MESHR.EXE. If you don't have privs or permission to move MESHR.EXE
  4462. into SYS$SHARE, you can $ DEFINE the MESHR logical name to be the full
  4463. name and location of the MESHR.EXE program. For example, you could
  4464. store all of these programs in the MICROEMACS$LIB: search list, and
  4465. say:
  4466.  
  4467.         $ DEFINE MESHR microemacs$lib:meshr.exe
  4468.  
  4469.     Note that this is the same location as is required for using kept
  4470. MicroEMACS.
  4471.  
  4472.     To abort sending a message, exit MicroEMACS without writing out
  4473. the mail message file.
  4474.  
  4475.     To use MicroEMACS as your VAX NOTES editor, issue the following
  4476. command to VAX NOTES:
  4477.  
  4478.         NOTES> SET PROFILE/EDIT=(ME,CALL)
  4479.  
  4480.     Note, if you are still in the dark ages of VMS V4, you will
  4481. have to either install MESHR as a known image, or following the
  4482. original "Second way" instructions given in the existing appendix F.6
  4483. of the older MicroEMACS manual (previous to version 3.10).
  4484.  
  4485. @flushleft(@b[Second way, as described in older versions])
  4486.  
  4487.     In the event that you cannot get your system manager to INSTALL
  4488. MicroEMACS as known image, you can use the following technique:
  4489.  
  4490. @begin(verbatim)
  4491. 1. In MICROEMACS$LIB:MEMAIL.COM, put the following command file:
  4492.  
  4493. $! Use on VAX/VMS as MAIL$EDIT for using MicroEMACS as mail editor.
  4494. $ if "''P1'" .NES. "_NL:" then if "''P1'" .NES. "" then copy 'P1' 'P2'
  4495. $ define/user sys$input sys$output
  4496. $ me 'P2'
  4497. $ exit
  4498.  
  4499. This file may have come with your MicroEMACS kit.
  4500.  
  4501. 2. In your LOGIN.COM, put the following lines:
  4502.  
  4503. $    me :== $MICROEMACS$LIB:MESHR.EXE ! Assumes meshr.exe is there
  4504. $    define mail$edit microemacs$lib:me_edit.com
  4505.  
  4506. 3. In NOTES, give the command
  4507.  
  4508. NOTES> SET PROFILE/EDIT=(@@MicroEMACS$lib:me_edit.com,SPAWN)
  4509.  
  4510. @flushleft(@b[System messages and EMACS])
  4511. MicroEMACS will intercept system broadcast messages and display them
  4512. on the message line after any input from the user.  These message are
  4513. stored in an INVISIBLE buffer named [-messages-].  To view these at your
  4514. convenience, use the following procedure:
  4515.  
  4516. @begin(verbatim)
  4517. ;
  4518. ; Show any system messages MicroEMACS may have intercepted.
  4519. ; The numeric prefix of pop-buffer ensures its invisibility.
  4520. ;
  4521. store-procedure "Show_messages"
  4522.     1 pop-buffer "[-messages-]"
  4523. !endm
  4524. @end(verbatim)
  4525.  
  4526. @flushleft(@b[Building MicroEMACS for VMS])
  4527.  
  4528. The configuration options are set in file estruct.h:
  4529.  
  4530. - Under the category of "Machine/OS definitions", set VMS to "1" and all
  4531. others to "0". 
  4532.  
  4533. - Under "Compiler definitions", set all selections to "0". Selecting
  4534. VMS implies that you are using VAXC.
  4535.  
  4536. - Under "Special keyboard definitions", be sure "VT100" is set to "0". 
  4537. This option is not required for the VMS version, it is for other
  4538. systems using ANSI terminal support. VMS in combination with SMG or
  4539. ANSI already handles the special characteristics of Ansi keyboards.
  4540.  
  4541. - Under "Terminal Output definitions", set either ANSI or SMG to "1"
  4542. and all others to "0". As stated previously, only ANSI supports the
  4543. mouse at this time.
  4544.  
  4545. - Under "Configuration options", you may select as you wish, with the
  4546. following notes:
  4547.  
  4548.     - COLOR    support does not exist for VMS, even when using
  4549.         color workstations.
  4550.     - MOUSE    support should be enabled if you have any VSII
  4551.         workstations. Only supported under the ANSI driver.
  4552.     - KEYPAD    support recognises whether your keypad is already
  4553.         in application mode or not, and puts your keypad
  4554.         in its correct state on exit.
  4555.     - XNONOFF    automatically allows you to use control-S or
  4556.         control-Q in MicroEMACS, by disabling the TTSYNC
  4557.         characteristic. This option should not be set if
  4558.         MicroEMACS might be used on DecStations or VT100s.
  4559.         It also should not be used with slow terminals or
  4560.         terminal emulators connected to fast terminal lines.
  4561.     - RMSIO    support should absolutely be used. This option
  4562.         allows the writing and reading of files in VMS's
  4563.         variable-length format, as opposed to STREAM-LF,
  4564.         and cuts down on file writing and reading time by
  4565.         approximately two thirds.
  4566.     - OPTMEM    support may be used on VMS versions 5.0 and higher.
  4567.         It substitutes the C library's memory allocation
  4568.         calls for the native VAX calls, and gives a speed
  4569.         improvement.
  4570. @end(verbatim)
  4571.  
  4572.     If you have MMS, you can use the supplied DESCRIP.MMS to build
  4573. MicroEMACS. Otherwise, the command file MEMAKE.COM has been provided.
  4574. These files assume that you are using SMG as your terminal driver. If
  4575. you are using ANSI, then you must replace SMG with ANSI in the command
  4576. and opt files. If you do not have MMS or are missing MEMAKE.COM,
  4577. simply compile each module with "CC", and link with the command:
  4578.  
  4579.     $ LINK MESHR/OPTION/SHARE
  4580.  
  4581.     Note that the executable filename must end in "SHR" in order
  4582. for MicroEMACS to be used as a callable editor from MAIL or NOTES. 
  4583. (Method 1 above.)
  4584.  
  4585.     If you edit any of the Emacs sources, note that any global or
  4586. external data must be declared as "noshare" in order for the VMS
  4587. callable editor support to work properly. This applies to all global
  4588. data used in the VMS version, but not to routines or to "static "data. 
  4589. The "noshare" declaration is #define'd away on non-VMS systems. If you
  4590. fail to do this, VMS will not allow you to INSTALL MicroEMACS as a
  4591. sharable library.
  4592. @newpage
  4593. @appendix(Mode Flags)
  4594.  
  4595.     The two environment variables, $cmode and $gmode, contain a
  4596. number the corresponds to the modes set for the current buffer and
  4597. the editor as a whole. These are encoded as the sum of the following
  4598. numbers for each of the possible modes:
  4599.  
  4600. @begin(verbatim)
  4601. WRAP      1        Word wrap
  4602. CMODE      2        C indentation and fence match
  4603. SPELL      4        Interactive spell checking (Not Implemented Yet)
  4604. EXACT      8        Exact matching for searches
  4605. VIEW     16        Read-only buffer
  4606. OVER     32        Overwrite mode
  4607. MAGIC     64        Regular expressions in search
  4608. CRYPT    128        Encryption mode active
  4609. ASAVE    256        Auto-save mode
  4610. @end(verbatim)
  4611.  
  4612.     So, if you wished to set the current buffer to have CMODE,
  4613. EXACT, and MAGIC on, and all the others off, you would add up the values
  4614. for those three, CMODE 2  +  EXACT 8  +  MAGIC 64 = 74, and use a
  4615. statement like:
  4616.  
  4617. set $cmode 74
  4618.  
  4619.     or, use the binary or operator to combine the different modes:
  4620.  
  4621. set $cmode &bor &bor 2 8 64
  4622.  
  4623. @flushleft(@big[Internal Flags])
  4624.  
  4625.     Some of the ways EMACS controls its internal functions can be
  4626. modified by the value in the $gflags@index($gflags) environment
  4627. variable. Each bit in this variable will be used to control a
  4628. different function.
  4629.  
  4630. @begin(verbatim)
  4631. GFFLAG        1    If this bit is set to zero, EMACS will not
  4632.             automatically switch to the buffer of the
  4633.             first file after executing the startup macroes.
  4634. GFSDRAW        2    If this bit is set to one, supress redraw events.
  4635. @end(verbatim)
  4636.  
  4637. @flushleft(@big[Current buffer flags])
  4638.  
  4639.     The $cbflags@index($cbflags) environment variable allows the
  4640. user to modify some of the characteristics of the current buffer. The
  4641. various characteristics are encoded as the sum of the following
  4642. numbers:
  4643.  
  4644. @begin(verbatim)
  4645. BFINVS        1    Internal invisible buffer
  4646. BFCHG        2    Changed since last write
  4647. BFTRUNC     4    buffer was truncated when read
  4648. BFNAROW     8    buffer has been narrowed
  4649. @end(verbatim)
  4650.  
  4651.     Only the invisible and changed flags can be modified by setting
  4652. the $cbflags variable. The truncated file and narrowed flags are read
  4653. only.
  4654.